diff --git a/api/regen/ecocredit/basket/v1/state.pulsar.go b/api/regen/ecocredit/basket/v1/state.pulsar.go index ef1ecc92f7..97b50f1d85 100644 --- a/api/regen/ecocredit/basket/v1/state.pulsar.go +++ b/api/regen/ecocredit/basket/v1/state.pulsar.go @@ -1975,6 +1975,11 @@ type Basket struct { // date_criteria is the date criteria for batches admitted to the basket. 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. + // Deprecated: This field is no longer used and will be removed in the next + // version. The credit type precision will always be used to convert credits + // to basket tokens and to determine the prefix part of the bank denom. + // + // Deprecated: Do not use. Exponent uint32 `protobuf:"varint,7,opt,name=exponent,proto3" json:"exponent,omitempty"` // curator is the address of the basket curator who is able to change certain // basket settings. @@ -2045,6 +2050,7 @@ func (x *Basket) GetDateCriteria() *DateCriteria { return nil } +// Deprecated: Do not use. func (x *Basket) GetExponent() uint32 { if x != nil { return x.Exponent @@ -2184,7 +2190,7 @@ var file_regen_ecocredit_basket_v1_state_proto_rawDesc = []byte{ 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x25, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe3, 0x02, 0x0a, 0x06, 0x42, 0x61, + 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe7, 0x02, 0x0a, 0x06, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x73, 0x6b, @@ -2200,52 +2206,52 @@ var file_regen_ecocredit_basket_v1_state_proto_rawDesc = []byte{ 0x32, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x65, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x52, 0x0c, 0x64, 0x61, 0x74, 0x65, 0x43, - 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x75, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x3a, 0x30, 0xf2, - 0x9e, 0xd3, 0x8e, 0x03, 0x2a, 0x0a, 0x06, 0x0a, 0x02, 0x69, 0x64, 0x10, 0x01, 0x12, 0x12, 0x0a, - 0x0c, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x10, 0x01, 0x18, - 0x01, 0x12, 0x0a, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x10, 0x02, 0x18, 0x01, 0x18, 0x01, 0x22, - 0x65, 0x0a, 0x0b, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x12, 0x1b, - 0x0a, 0x09, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x08, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, - 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x3a, 0x1e, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x18, 0x0a, 0x14, - 0x0a, 0x12, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x2c, 0x63, 0x6c, 0x61, 0x73, - 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x22, 0xf0, 0x01, 0x0a, 0x0d, 0x42, 0x61, 0x73, 0x6b, 0x65, - 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x6b, - 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x62, 0x61, 0x73, - 0x6b, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, - 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x74, 0x63, - 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, - 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, - 0x12, 0x44, 0x0a, 0x10, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, - 0x64, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0e, 0x62, 0x61, 0x74, 0x63, 0x68, 0x53, 0x74, 0x61, - 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, 0x3a, 0x41, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x3b, 0x0a, 0x17, - 0x0a, 0x15, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x2c, 0x62, 0x61, 0x74, 0x63, - 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x1e, 0x0a, 0x1a, 0x62, 0x61, 0x73, 0x6b, 0x65, - 0x74, 0x5f, 0x69, 0x64, 0x2c, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, - 0x5f, 0x64, 0x61, 0x74, 0x65, 0x10, 0x01, 0x18, 0x03, 0x42, 0x80, 0x02, 0x0a, 0x1d, 0x63, 0x6f, - 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4c, 0x67, 0x69, 0x74, 0x68, 0x75, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x2f, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x62, - 0x61, 0x73, 0x6b, 0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x42, 0xaa, 0x02, 0x19, - 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, - 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, + 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x12, 0x1e, 0x0a, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, + 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x02, 0x18, 0x01, 0x52, 0x08, 0x65, + 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x61, 0x74, + 0x6f, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x63, 0x75, 0x72, 0x61, 0x74, 0x6f, + 0x72, 0x3a, 0x30, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x2a, 0x0a, 0x06, 0x0a, 0x02, 0x69, 0x64, 0x10, + 0x01, 0x12, 0x12, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x64, 0x65, 0x6e, 0x6f, + 0x6d, 0x10, 0x01, 0x18, 0x01, 0x12, 0x0a, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x10, 0x02, 0x18, + 0x01, 0x18, 0x01, 0x22, 0x65, 0x0a, 0x0b, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x43, 0x6c, 0x61, + 0x73, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x49, 0x64, 0x12, + 0x19, 0x0a, 0x08, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x49, 0x64, 0x3a, 0x1e, 0xf2, 0x9e, 0xd3, 0x8e, + 0x03, 0x18, 0x0a, 0x14, 0x0a, 0x12, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x2c, + 0x63, 0x6c, 0x61, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x22, 0xf0, 0x01, 0x0a, 0x0d, 0x42, + 0x61, 0x73, 0x6b, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, + 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x08, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x74, + 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, + 0x62, 0x61, 0x74, 0x63, 0x68, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, + 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x6c, + 0x61, 0x6e, 0x63, 0x65, 0x12, 0x44, 0x0a, 0x10, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, 0x74, + 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, + 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, + 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0e, 0x62, 0x61, 0x74, 0x63, + 0x68, 0x53, 0x74, 0x61, 0x72, 0x74, 0x44, 0x61, 0x74, 0x65, 0x3a, 0x41, 0xf2, 0x9e, 0xd3, 0x8e, + 0x03, 0x3b, 0x0a, 0x17, 0x0a, 0x15, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x2c, + 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x1e, 0x0a, 0x1a, 0x62, + 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x2c, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x73, + 0x74, 0x61, 0x72, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x65, 0x10, 0x01, 0x18, 0x03, 0x42, 0x80, 0x02, + 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x42, + 0x0a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4c, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, + 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6c, 0x65, + 0x64, 0x67, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, + 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2f, + 0x76, 0x31, 0x3b, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, + 0x42, 0xaa, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x19, + 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, + 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x25, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x42, 0x61, 0x73, 0x6b, - 0x65, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x25, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, - 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5c, 0x56, - 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, - 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x3a, 0x3a, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0xea, 0x02, 0x1c, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/regen/ecocredit/basket/v1/tx.pulsar.go b/api/regen/ecocredit/basket/v1/tx.pulsar.go index 51a2159f9c..9d90a87677 100644 --- a/api/regen/ecocredit/basket/v1/tx.pulsar.go +++ b/api/regen/ecocredit/basket/v1/tx.pulsar.go @@ -3748,6 +3748,12 @@ type MsgCreate struct { // 18 - a (atto) // 21 - z (zepto) // 24 - y (yocto) + // + // Deprecated: This field is no longer used and will be removed in the next + // version. The credit type precision will always be used to convert credits + // to basket tokens and to determine the prefix part of the bank denom. + // + // Deprecated: Do not use. 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 @@ -3812,6 +3818,7 @@ func (x *MsgCreate) GetDescription() string { return "" } +// Deprecated: Do not use. func (x *MsgCreate) GetExponent() uint32 { if x != nil { return x.Exponent @@ -4111,101 +4118,101 @@ var file_regen_ecocredit_basket_v1_tx_proto_rawDesc = []byte{ 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, - 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xab, 0x03, 0x0a, + 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xaf, 0x03, 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x75, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x75, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, - 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x65, 0x78, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, - 0x65, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x11, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x41, 0x75, 0x74, 0x6f, - 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x61, 0x62, 0x62, 0x72, 0x65, 0x76, 0x18, 0x06, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x10, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, 0x70, 0x65, 0x41, 0x62, - 0x62, 0x72, 0x65, 0x76, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x5f, - 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0e, 0x61, - 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x12, 0x4c, 0x0a, - 0x0d, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, - 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, - 0x2e, 0x44, 0x61, 0x74, 0x65, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x52, 0x0c, 0x64, - 0x61, 0x74, 0x65, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x12, 0x5d, 0x0a, 0x03, 0x66, - 0x65, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, - 0x6f, 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, - 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x03, 0x66, 0x65, 0x65, 0x22, 0x36, 0x0a, 0x11, 0x4d, 0x73, - 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x44, 0x65, 0x6e, - 0x6f, 0x6d, 0x22, 0x84, 0x01, 0x0a, 0x06, 0x4d, 0x73, 0x67, 0x50, 0x75, 0x74, 0x12, 0x14, 0x0a, - 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, - 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x64, 0x65, - 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x73, 0x6b, 0x65, - 0x74, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x41, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, - 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, - 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x22, 0x39, 0x0a, 0x0e, 0x4d, 0x73, 0x67, - 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x61, - 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x65, 0x63, 0x65, - 0x69, 0x76, 0x65, 0x64, 0x22, 0xb9, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, 0x54, 0x61, 0x6b, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, - 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, - 0x73, 0x6b, 0x65, 0x74, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x37, 0x0a, 0x17, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, - 0x6a, 0x75, 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x16, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4a, 0x75, - 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, 0x0a, 0x0e, 0x72, 0x65, - 0x74, 0x69, 0x72, 0x65, 0x5f, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x6b, 0x65, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0c, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x4f, 0x6e, 0x54, 0x61, 0x6b, 0x65, - 0x22, 0x54, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x54, 0x61, 0x6b, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, - 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, - 0x2e, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x69, 0x74, 0x52, 0x07, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x32, 0x90, 0x02, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x5c, - 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x24, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x08, 0x65, 0x78, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x02, 0x18, 0x01, + 0x52, 0x08, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x69, + 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x74, 0x69, 0x72, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, + 0x41, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x74, 0x69, 0x72, 0x65, 0x12, 0x2c, 0x0a, 0x12, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x61, 0x62, 0x62, 0x72, 0x65, 0x76, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x41, 0x62, 0x62, 0x72, 0x65, 0x76, 0x12, 0x27, 0x0a, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, + 0x77, 0x65, 0x64, 0x5f, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0e, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x65, + 0x73, 0x12, 0x4c, 0x0a, 0x0d, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x72, 0x69, 0x74, 0x65, 0x72, + 0x69, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, - 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x1a, 0x2c, - 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, - 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x03, - 0x50, 0x75, 0x74, 0x12, 0x21, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, - 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x50, 0x75, 0x74, 0x1a, 0x29, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, - 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x56, 0x0a, 0x04, 0x54, 0x61, 0x6b, 0x65, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, - 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, - 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x61, 0x6b, 0x65, 0x1a, 0x2a, 0x2e, + 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x61, 0x74, 0x65, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, + 0x61, 0x52, 0x0c, 0x64, 0x61, 0x74, 0x65, 0x43, 0x72, 0x69, 0x74, 0x65, 0x72, 0x69, 0x61, 0x12, + 0x5d, 0x0a, 0x03, 0x66, 0x65, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, + 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, + 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x03, 0x66, 0x65, 0x65, 0x22, 0x36, + 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x64, 0x65, + 0x6e, 0x6f, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x73, 0x6b, 0x65, + 0x74, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x84, 0x01, 0x0a, 0x06, 0x4d, 0x73, 0x67, 0x50, 0x75, + 0x74, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x73, 0x6b, 0x65, + 0x74, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, + 0x61, 0x73, 0x6b, 0x65, 0x74, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x41, 0x0a, 0x07, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x65, + 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, + 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x43, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x22, 0x39, 0x0a, + 0x0e, 0x4d, 0x73, 0x67, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x27, 0x0a, 0x0f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, + 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x64, 0x22, 0xb9, 0x01, 0x0a, 0x07, 0x4d, 0x73, 0x67, + 0x54, 0x61, 0x6b, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, + 0x73, 0x6b, 0x65, 0x74, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x16, 0x0a, + 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x37, 0x0a, 0x17, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, + 0x65, 0x6e, 0x74, 0x5f, 0x6a, 0x75, 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x16, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x6d, 0x65, + 0x6e, 0x74, 0x4a, 0x75, 0x72, 0x69, 0x73, 0x64, 0x69, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x24, + 0x0a, 0x0e, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x5f, 0x6f, 0x6e, 0x5f, 0x74, 0x61, 0x6b, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x72, 0x65, 0x74, 0x69, 0x72, 0x65, 0x4f, 0x6e, + 0x54, 0x61, 0x6b, 0x65, 0x22, 0x54, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x54, 0x61, 0x6b, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, + 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, + 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x43, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x52, 0x07, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x73, 0x32, 0x90, 0x02, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x12, 0x5c, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x24, 0x2e, 0x72, + 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, + 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x1a, 0x2c, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, + 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x53, 0x0a, 0x03, 0x50, 0x75, 0x74, 0x12, 0x21, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, + 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x75, 0x74, 0x1a, 0x29, 0x2e, 0x72, 0x65, 0x67, + 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, + 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x75, 0x74, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x04, 0x54, 0x61, 0x6b, 0x65, 0x12, 0x22, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x54, 0x61, 0x6b, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xfd, 0x01, 0x0a, 0x1d, 0x63, 0x6f, - 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4c, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, - 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x72, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, - 0x74, 0x2f, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x3b, 0x62, 0x61, 0x73, 0x6b, - 0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x42, 0xaa, 0x02, 0x19, 0x52, 0x65, 0x67, - 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x42, 0x61, 0x73, - 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, + 0x65, 0x1a, 0x2a, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, 0x72, 0x65, + 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, + 0x67, 0x54, 0x61, 0x6b, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0xfd, 0x01, + 0x0a, 0x1d, 0x63, 0x6f, 0x6d, 0x2e, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x65, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x2e, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x76, 0x31, 0x42, + 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4c, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2d, 0x6c, 0x65, 0x64, 0x67, 0x65, + 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x65, 0x67, 0x65, 0x6e, 0x2f, 0x65, 0x63, 0x6f, 0x63, + 0x72, 0x65, 0x64, 0x69, 0x74, 0x2f, 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2f, 0x76, 0x31, 0x3b, + 0x62, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x52, 0x45, 0x42, 0xaa, 0x02, + 0x19, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x2e, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, + 0x2e, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x19, 0x52, 0x65, 0x67, + 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x42, 0x61, 0x73, + 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x25, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x5c, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5c, - 0x56, 0x31, 0xe2, 0x02, 0x25, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x5c, 0x45, 0x63, 0x6f, 0x63, 0x72, - 0x65, 0x64, 0x69, 0x74, 0x5c, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x5c, 0x56, 0x31, 0x5c, 0x47, - 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x1c, 0x52, 0x65, 0x67, - 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, 0x74, 0x3a, 0x3a, 0x42, - 0x61, 0x73, 0x6b, 0x65, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, + 0x1c, 0x52, 0x65, 0x67, 0x65, 0x6e, 0x3a, 0x3a, 0x45, 0x63, 0x6f, 0x63, 0x72, 0x65, 0x64, 0x69, + 0x74, 0x3a, 0x3a, 0x42, 0x61, 0x73, 0x6b, 0x65, 0x74, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/regen/ecocredit/basket/v1/state.proto b/proto/regen/ecocredit/basket/v1/state.proto index b32b5125e1..a1c3486fe6 100644 --- a/proto/regen/ecocredit/basket/v1/state.proto +++ b/proto/regen/ecocredit/basket/v1/state.proto @@ -22,7 +22,21 @@ message Basket { // storage space. uint64 id = 1; - // basket_denom is the basket bank denom. + // basket_denom is the basket bank denom formed from name and credit type with + // the format `eco..` where prefix is the + // prefix of the bank denom exponent, a standard SI unit derived from credit + // type precision, and 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) string basket_denom = 2; // name is the unique name of the basket specified in MsgCreate. Basket @@ -41,8 +55,11 @@ message Basket { // date_criteria is the date criteria for batches admitted to the basket. DateCriteria date_criteria = 6; - // exponent is the exponent for converting credits to/from basket tokens. - uint32 exponent = 7; + // Deprecated (Since Revision 1): This field is no longer used and will be + // removed in the next version. The value of credit type precision is always + // used as the exponent when converting credits to/from basket tokens. This + // field will be set to the value of credit type precision until removed. + uint32 exponent = 7 [ deprecated = true ]; // curator is the address of the basket curator who is able to change certain // basket settings. diff --git a/proto/regen/ecocredit/basket/v1/tx.proto b/proto/regen/ecocredit/basket/v1/tx.proto index ba8dbcbb39..2bf03fc637 100644 --- a/proto/regen/ecocredit/basket/v1/tx.proto +++ b/proto/regen/ecocredit/basket/v1/tx.proto @@ -32,40 +32,20 @@ message MsgCreate { // basket token. It can be between 3-8 alphanumeric characters, with the // 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. + // The bank denom will be formed from name and credit type with the format + // `eco..` where prefix is the prefix of + // a standard SI unit derived from credit type precision. string name = 2; // description is a human-readable description of the basket denom that should // be at most 256 characters. 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 - // 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 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; + // Deprecated (Since Revision 1): This field is no longer used and will be + // removed in the next version. The value of credit type precision is always + // used as the exponent when determining the prefix for basket denom, defining + // bank denom metadata, and converting credits to/from basket tokens. + uint32 exponent = 4 [ deprecated = true ]; // disable_auto_retire allows auto-retirement to be disabled. // The credits will be auto-retired if disable_auto_retire is diff --git a/proto/regen/ecocredit/v1/query.proto b/proto/regen/ecocredit/v1/query.proto index 24512c1f80..b6ac8a8bd6 100644 --- a/proto/regen/ecocredit/v1/query.proto +++ b/proto/regen/ecocredit/v1/query.proto @@ -58,8 +58,7 @@ service Query { // Batches queries for all batches with pagination. rpc Batches(QueryBatchesRequest) returns (QueryBatchesResponse) { - option (google.api.http).get = - "/regen/ecocredit/v1/batches"; + option (google.api.http).get = "/regen/ecocredit/v1/batches"; } // BatchesByIssuer queries all batches issued from a given issuer address. @@ -76,8 +75,10 @@ service Query { "/regen/ecocredit/v1/batches/class/{class_id}"; } - // BatchesByProject queries for all batches from a given project with pagination. - rpc BatchesByProject(QueryBatchesByProjectRequest) returns (QueryBatchesByProjectResponse) { + // BatchesByProject queries for all batches from a given project with + // pagination. + rpc BatchesByProject(QueryBatchesByProjectRequest) + returns (QueryBatchesByProjectResponse) { option (google.api.http).get = "/regen/ecocredit/v1/batches/project/{project_id}"; } diff --git a/x/ecocredit/basket/features/msg_create.feature b/x/ecocredit/basket/features/msg_create.feature index e465aa0bf9..75d539cd36 100644 --- a/x/ecocredit/basket/features/msg_create.feature +++ b/x/ecocredit/basket/features/msg_create.feature @@ -31,36 +31,6 @@ Feature: MsgCreate When the message is validated Then expect no error - Scenario Outline: a valid message with exponent - Given the message - """ - { - "curator": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27", - "name": "NCT", - "exponent": , - "credit_type_abbrev": "C", - "allowed_classes": [ - "C01" - ] - } - """ - When the message is validated - Then expect no error - - Examples: - | description | exponent | - | no prefix | 0 | - | d (deci) | 1 | - | c (centi) | 2 | - | m (milli) | 3 | - | u (micro) | 6 | - | n (nano) | 9 | - | p (pico) | 12 | - | f (femto) | 15 | - | a (atto) | 18 | - | z (zepto) | 21 | - | y (yocto) | 24 | - Scenario Outline: a valid message with disable auto-retire Given the message """ @@ -209,18 +179,6 @@ Feature: MsgCreate When the message is validated Then expect the error "description length cannot be greater than 256 characters: invalid request" - Scenario: an error is returned if exponent does not have a corresponding SI prefix - Given the message - """ - { - "curator": "cosmos1depk54cuajgkzea6zpgkq36tnjwdzv4afc3d27", - "name": "NCT", - "exponent": 4 - } - """ - When the message is validated - Then expect the error "exponent must be one of [0 1 2 3 6 9 12 15 18 21 24]: invalid request" - Scenario: an error is returned if credit type abbreviation is empty Given the message """ diff --git a/x/ecocredit/basket/msg_create.go b/x/ecocredit/basket/msg_create.go index 424a24552b..18b08672bf 100644 --- a/x/ecocredit/basket/msg_create.go +++ b/x/ecocredit/basket/msg_create.go @@ -55,10 +55,6 @@ func (m MsgCreate) ValidateBasic() error { return sdkerrors.ErrInvalidRequest.Wrapf("description length cannot be greater than %d characters", descrMaxLen) } - if _, err := core.ExponentToPrefix(m.Exponent); err != nil { - return err - } - if len(m.CreditTypeAbbrev) == 0 { return sdkerrors.ErrInvalidRequest.Wrapf("credit type abbreviation cannot be empty") } diff --git a/x/ecocredit/basket/state.pb.go b/x/ecocredit/basket/state.pb.go index a00183a231..a4578ff2d7 100644 --- a/x/ecocredit/basket/state.pb.go +++ b/x/ecocredit/basket/state.pb.go @@ -46,7 +46,10 @@ type Basket struct { // date_criteria is the date criteria for batches admitted to the basket. 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,7,opt,name=exponent,proto3" json:"exponent,omitempty"` + // Deprecated: This field is no longer used and will be removed in the next + // version. The credit type precision will always be used to convert credits + // to basket tokens and to determine the prefix part of the bank denom. + Exponent uint32 `protobuf:"varint,7,opt,name=exponent,proto3" json:"exponent,omitempty"` // Deprecated: Do not use. // curator is the address of the basket curator who is able to change certain // basket settings. // @@ -129,6 +132,7 @@ func (m *Basket) GetDateCriteria() *DateCriteria { return nil } +// Deprecated: Do not use. func (m *Basket) GetExponent() uint32 { if m != nil { return m.Exponent @@ -284,43 +288,43 @@ func init() { } var fileDescriptor_c416a19075224f85 = []byte{ - // 565 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xee, 0xa6, 0xfd, 0x93, 0x74, 0xd2, 0x56, 0xfe, 0x17, 0x10, 0xdb, 0x20, 0x5c, 0x53, 0x09, - 0x61, 0xa1, 0x62, 0x93, 0x72, 0x41, 0xe5, 0xd4, 0x36, 0x97, 0x4a, 0x9c, 0x4c, 0x4f, 0x5c, 0xac, - 0xb5, 0x3d, 0x24, 0x56, 0x6d, 0xaf, 0xb5, 0xde, 0x84, 0xf6, 0x25, 0x10, 0x4f, 0xc0, 0xf3, 0x70, - 0xac, 0xc4, 0x85, 0x23, 0x4a, 0x5e, 0x00, 0xf1, 0x04, 0xc8, 0xbb, 0x4e, 0xd2, 0x82, 0xe8, 0x2d, - 0xdf, 0x7c, 0xdf, 0xe7, 0x99, 0xfd, 0x66, 0x02, 0x4f, 0x25, 0x8e, 0xb0, 0xf0, 0x31, 0x16, 0xb1, - 0xc4, 0x24, 0x55, 0x7e, 0xc4, 0xab, 0x0b, 0x54, 0xfe, 0x74, 0xe0, 0x57, 0x8a, 0x2b, 0xf4, 0x4a, - 0x29, 0x94, 0xa0, 0xbb, 0x5a, 0xe6, 0x2d, 0x65, 0x9e, 0x91, 0x79, 0xd3, 0x41, 0xff, 0x71, 0x2c, - 0xaa, 0x5c, 0x54, 0xbe, 0x90, 0xb9, 0x3f, 0x1d, 0xf0, 0xac, 0x1c, 0xf3, 0x41, 0x0d, 0x8c, 0xb3, - 0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x9e, 0xdb, - 0x6b, 0xdf, 0xe7, 0xf6, 0xda, 0xfb, 0xd7, 0xa3, 0x54, 0x8d, 0x27, 0x91, 0x17, 0x8b, 0xdc, 0xd7, - 0xc7, 0xf1, 0xa2, 0x40, 0xf5, 0x51, 0xc8, 0x8b, 0x06, 0x65, 0x98, 0x8c, 0x50, 0xfa, 0x97, 0x7f, - 0xfd, 0x45, 0xa2, 0xb6, 0x1e, 0xfd, 0xd5, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x66, 0x8d, 0xe9, - 0x68, 0xc5, 0x03, 0x00, 0x00, + // 567 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xc1, 0x6e, 0xd3, 0x40, + 0x10, 0xed, 0xba, 0x25, 0x49, 0x27, 0x6d, 0x65, 0x16, 0x10, 0xdb, 0x20, 0x5c, 0x53, 0x09, 0x61, + 0xa1, 0x62, 0x93, 0x72, 0x41, 0xe5, 0xd4, 0xb4, 0x97, 0x4a, 0x9c, 0x4c, 0x4f, 0x5c, 0xac, 0xb5, + 0x3d, 0xa4, 0x56, 0x6d, 0xaf, 0xb5, 0xde, 0x84, 0xf6, 0x27, 0x10, 0x5f, 0xc0, 0xf7, 0x70, 0xac, + 0xc4, 0x85, 0x23, 0x6a, 0x0f, 0x5c, 0x11, 0x5f, 0x80, 0xbc, 0xeb, 0x24, 0x2d, 0x88, 0xde, 0xf2, + 0xe6, 0xbd, 0xe7, 0x99, 0x7d, 0x33, 0x81, 0xa7, 0x12, 0xc7, 0x58, 0x06, 0x98, 0x88, 0x44, 0x62, + 0x9a, 0xa9, 0x20, 0xe6, 0xf5, 0x29, 0xaa, 0x60, 0x3a, 0x0c, 0x6a, 0xc5, 0x15, 0xfa, 0x95, 0x14, + 0x4a, 0xd0, 0x4d, 0x2d, 0xf3, 0xe7, 0x32, 0xdf, 0xc8, 0xfc, 0xe9, 0x70, 0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37, 0xb1, 0x68, 0x68, 0x13, 0xb6, 0x3c, + 0x0a, 0xbf, 0x5e, 0x3a, 0xe4, 0xe2, 0xd2, 0x21, 0x3f, 0x2e, 0x1d, 0xf2, 0xf9, 0xca, 0x59, 0xba, + 0xb8, 0x72, 0x96, 0xbe, 0x5f, 0x39, 0x4b, 0xef, 0x5f, 0x8f, 0x33, 0x75, 0x32, 0x89, 0xfd, 0x44, + 0x14, 0x81, 0x3e, 0x90, 0x17, 0x25, 0xaa, 0x8f, 0x42, 0x9e, 0xb6, 0x28, 0xc7, 0x74, 0x8c, 0x32, + 0x38, 0xfb, 0xe7, 0x6f, 0x12, 0x77, 0xf4, 0xe8, 0xaf, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x51, + 0xb2, 0x58, 0xb2, 0xc9, 0x03, 0x00, 0x00, } func (m *Basket) Marshal() (dAtA []byte, err error) { diff --git a/x/ecocredit/basket/tx.pb.go b/x/ecocredit/basket/tx.pb.go index 33db7c1bf0..ca59a0362b 100644 --- a/x/ecocredit/basket/tx.pb.go +++ b/x/ecocredit/basket/tx.pb.go @@ -70,7 +70,11 @@ type MsgCreate struct { // 18 - a (atto) // 21 - z (zepto) // 24 - y (yocto) - Exponent uint32 `protobuf:"varint,4,opt,name=exponent,proto3" json:"exponent,omitempty"` + // + // Deprecated: This field is no longer used and will be removed in the next + // version. The credit type precision will always be used to convert credits + // to basket tokens and to determine the prefix part of the bank denom. + Exponent uint32 `protobuf:"varint,4,opt,name=exponent,proto3" json:"exponent,omitempty"` // Deprecated: Do not use. // 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 @@ -147,6 +151,7 @@ func (m *MsgCreate) GetDescription() string { return "" } +// Deprecated: Do not use. func (m *MsgCreate) GetExponent() uint32 { if m != nil { return m.Exponent @@ -493,51 +498,51 @@ func init() { } var fileDescriptor_a60f962a3c61f018 = []byte{ - // 689 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcd, 0x4e, 0xdb, 0x4c, - 0x14, 0x8d, 0x71, 0x48, 0xc8, 0x04, 0xc2, 0xc7, 0x7c, 0x88, 0x9a, 0x2c, 0x42, 0xb0, 0xa8, 0x48, - 0x2b, 0xb0, 0x1b, 0x2a, 0xf5, 0x67, 0x09, 0x61, 0x55, 0x35, 0x2a, 0x72, 0x51, 0x17, 0x55, 0x2b, - 0xcb, 0xb1, 0x6f, 0x5d, 0x37, 0xc9, 0x4c, 0x34, 0x33, 0x0e, 0xb0, 0xef, 0x03, 0xf0, 0x1c, 0xed, - 0x13, 0xf4, 0x0d, 0x58, 0xb2, 0xec, 0xaa, 0xad, 0xe0, 0x45, 0x2a, 0xcf, 0x4c, 0xdc, 0x48, 0xa8, - 0xa1, 0x62, 0x15, 0xdf, 0x73, 0xce, 0x3d, 0xb9, 0x7f, 0x36, 0xb2, 0x19, 0xc4, 0x40, 0x5c, 0x08, - 0x69, 0xc8, 0x20, 0x4a, 0x84, 0xdb, 0x0b, 0x78, 0x1f, 0x84, 0x3b, 0x6e, 0xbb, 0xe2, 0xd4, 0x19, - 0x31, 0x2a, 0x28, 0x5e, 0x97, 0x1a, 0x27, 0xd7, 0x38, 0x4a, 0xe3, 0x8c, 0xdb, 0xf5, 0xd5, 0x98, - 0xc6, 0x54, 0xaa, 0xdc, 0xec, 0x49, 0x25, 0xd4, 0xef, 0xcf, 0x30, 0x3d, 0x1b, 0x01, 0xd7, 0xb2, - 0x46, 0x48, 0xf9, 0x90, 0xf2, 0x8c, 0x05, 0x77, 0xdc, 0xee, 0x81, 0x08, 0xda, 0x6e, 0x48, 0x13, - 0xa2, 0x78, 0xfb, 0xab, 0x89, 0x2a, 0x5d, 0x1e, 0x77, 0x18, 0x04, 0x02, 0xb0, 0x85, 0xca, 0x61, - 0xca, 0x02, 0x41, 0x99, 0x65, 0x34, 0x8d, 0x56, 0xc5, 0x9b, 0x84, 0x18, 0xa3, 0x22, 0x09, 0x86, - 0x60, 0xcd, 0x49, 0x58, 0x3e, 0xe3, 0x26, 0xaa, 0x46, 0xc0, 0x43, 0x96, 0x8c, 0x44, 0x42, 0x89, - 0x65, 0x4a, 0x6a, 0x1a, 0xc2, 0x75, 0xb4, 0x00, 0xa7, 0x23, 0x4a, 0x80, 0x08, 0xab, 0xd8, 0x34, - 0x5a, 0x4b, 0x5e, 0x1e, 0x63, 0x07, 0xfd, 0x1f, 0x25, 0x3c, 0xe8, 0x0d, 0xc0, 0x0f, 0x52, 0x41, - 0x7d, 0x06, 0x22, 0x61, 0x60, 0xcd, 0x37, 0x8d, 0xd6, 0x82, 0xb7, 0xa2, 0xa9, 0xfd, 0x54, 0x50, - 0x4f, 0x12, 0x78, 0x07, 0x61, 0xd5, 0xa9, 0x9f, 0xf5, 0xe7, 0x07, 0xbd, 0x1e, 0x83, 0xb1, 0x55, - 0x92, 0x7f, 0xfa, 0x9f, 0x62, 0x8e, 0xcf, 0x46, 0xb0, 0x2f, 0x71, 0xbc, 0x8d, 0x96, 0x83, 0xc1, - 0x80, 0x9e, 0x40, 0xe4, 0x87, 0x83, 0x80, 0x73, 0xe0, 0x56, 0xb9, 0x69, 0xb6, 0x2a, 0x5e, 0x4d, - 0xc3, 0x1d, 0x85, 0xe2, 0x97, 0x68, 0x29, 0x0a, 0x04, 0xf8, 0x21, 0x4b, 0x04, 0xb0, 0x24, 0xb0, - 0x16, 0x9a, 0x46, 0xab, 0xba, 0xb7, 0xed, 0xfc, 0x75, 0x21, 0xce, 0x61, 0x20, 0xa0, 0xa3, 0xe5, - 0xde, 0x62, 0x34, 0x15, 0xe1, 0xf7, 0xc8, 0xfc, 0x00, 0x60, 0x55, 0x9a, 0x66, 0xab, 0xba, 0xb7, - 0xee, 0xa8, 0xe1, 0x67, 0xa9, 0xe0, 0xe8, 0xe1, 0x3b, 0x1d, 0x9a, 0x90, 0x83, 0x47, 0x17, 0x3f, - 0x36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 0x8a, 0x64, 0xf5, 0xda, 0xc7, 0x68, 0x59, 0x97, 0x9e, - 0xf7, 0x3d, 0x35, 0x4c, 0xe3, 0x6e, 0xc3, 0xdc, 0x3b, 0x9f, 0x43, 0x66, 0x97, 0xc7, 0xf8, 0x1d, - 0x2a, 0xe9, 0xb7, 0x77, 0x6b, 0x86, 0x47, 0x7e, 0x36, 0xf5, 0x9d, 0x7f, 0x51, 0xe5, 0x85, 0xbe, - 0x46, 0x66, 0x76, 0x35, 0x9b, 0xb3, 0x93, 0x8e, 0x52, 0x51, 0x7f, 0x70, 0xab, 0x24, 0x37, 0x7d, - 0x83, 0x8a, 0x72, 0x91, 0xf6, 0xec, 0x94, 0x4c, 0x53, 0x7f, 0x78, 0xbb, 0x66, 0xe2, 0x7b, 0xe0, - 0x5d, 0x5c, 0x35, 0x8c, 0xcb, 0xab, 0x86, 0xf1, 0xeb, 0xaa, 0x61, 0x9c, 0x5f, 0x37, 0x0a, 0x97, - 0xd7, 0x8d, 0xc2, 0xf7, 0xeb, 0x46, 0xe1, 0xed, 0xb3, 0xa9, 0xf7, 0x4c, 0xfa, 0xed, 0x12, 0x10, - 0x27, 0x94, 0xf5, 0x75, 0x34, 0x80, 0x28, 0x06, 0xe6, 0x9e, 0xde, 0xf8, 0x9e, 0xf6, 0x4a, 0xf2, - 0x3b, 0xf9, 0xf8, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x33, 0xc7, 0xd1, 0x3a, 0xc5, 0x05, 0x00, - 0x00, + // 694 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xcf, 0x4e, 0xdb, 0x4e, + 0x10, 0x8e, 0xe3, 0x90, 0x90, 0x0d, 0x84, 0x1f, 0xfb, 0x43, 0xd4, 0xe4, 0x60, 0x82, 0x45, 0x45, + 0x5a, 0x81, 0xdd, 0x50, 0xa9, 0x7f, 0x8e, 0x24, 0x9c, 0xaa, 0x46, 0x45, 0x2e, 0xea, 0xa1, 0x6a, + 0x65, 0x39, 0xf6, 0xd4, 0x75, 0x93, 0x78, 0xa3, 0xdd, 0x75, 0x80, 0x7b, 0x1f, 0x80, 0xe7, 0xe8, + 0xa5, 0xe7, 0xbe, 0x01, 0x47, 0x8e, 0x3d, 0xb5, 0x15, 0xbc, 0x48, 0xe5, 0xdd, 0x8d, 0x1b, 0x09, + 0x35, 0x54, 0x9c, 0xb2, 0xf3, 0xcd, 0x37, 0x5f, 0x66, 0xf6, 0x1b, 0x2f, 0xb2, 0x28, 0x44, 0x90, + 0x38, 0x10, 0x90, 0x80, 0x42, 0x18, 0x73, 0xa7, 0xef, 0xb3, 0x01, 0x70, 0x67, 0xd2, 0x76, 0xf8, + 0xa9, 0x3d, 0xa6, 0x84, 0x13, 0xbc, 0x21, 0x38, 0x76, 0xce, 0xb1, 0x25, 0xc7, 0x9e, 0xb4, 0x1b, + 0x6b, 0x11, 0x89, 0x88, 0x60, 0x39, 0xd9, 0x49, 0x16, 0x34, 0xee, 0xcf, 0x11, 0x3d, 0x1b, 0x03, + 0x53, 0x34, 0x33, 0x20, 0x6c, 0x44, 0x58, 0x96, 0x05, 0x67, 0xd2, 0xee, 0x03, 0xf7, 0xdb, 0x4e, + 0x40, 0xe2, 0x44, 0xe6, 0xad, 0xaf, 0x3a, 0xaa, 0xf6, 0x58, 0xd4, 0xa5, 0xe0, 0x73, 0xc0, 0x06, + 0xaa, 0x04, 0x29, 0xf5, 0x39, 0xa1, 0x86, 0xd6, 0xd4, 0x5a, 0x55, 0x77, 0x1a, 0x62, 0x8c, 0x4a, + 0x89, 0x3f, 0x02, 0xa3, 0x28, 0x60, 0x71, 0xc6, 0x4d, 0x54, 0x0b, 0x81, 0x05, 0x34, 0x1e, 0xf3, + 0x98, 0x24, 0x86, 0x2e, 0x52, 0xb3, 0x10, 0x36, 0xd1, 0x22, 0x9c, 0x8e, 0x49, 0x02, 0x09, 0x37, + 0x4a, 0x4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0x34, + 0x76, 0xff, 0x85, 0x95, 0x37, 0xfa, 0x1a, 0xe9, 0xd9, 0xd6, 0x6c, 0xcd, 0x2f, 0x3a, 0x4a, 0x79, + 0xe3, 0xc1, 0xad, 0x94, 0x5c, 0xf4, 0x0d, 0x2a, 0x09, 0x23, 0xad, 0xf9, 0x25, 0x19, 0xa7, 0xf1, + 0xf0, 0x76, 0xce, 0x54, 0xb7, 0xe3, 0x5e, 0x5c, 0x99, 0xda, 0xe5, 0x95, 0xa9, 0xfd, 0xba, 0x32, + 0xb5, 0xf3, 0x6b, 0xb3, 0x70, 0x79, 0x6d, 0x16, 0xbe, 0x5f, 0x9b, 0x85, 0xb7, 0xcf, 0x66, 0xbe, + 0x33, 0xa1, 0xb7, 0x97, 0x00, 0x3f, 0x21, 0x74, 0xa0, 0xa2, 0x21, 0x84, 0x11, 0x50, 0xe7, 0xf4, + 0xc6, 0x9b, 0xda, 0x2f, 0x8b, 0xb7, 0xf2, 0xf1, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe6, 0x0f, + 0x7d, 0x6d, 0xc9, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/ecocredit/core/params.go b/x/ecocredit/core/params.go index 2351f78244..a1cb3b0523 100644 --- a/x/ecocredit/core/params.go +++ b/x/ecocredit/core/params.go @@ -16,7 +16,7 @@ var ( KeyBasketCreationFee = []byte("BasketCreationFee") ) -// TODO: remove after we open governance changes for precision +// TODO: remove after we allow standard SI units for precision const ( PRECISION uint32 = 6 diff --git a/x/ecocredit/server/basket/features/msg_create.feature b/x/ecocredit/server/basket/features/msg_create.feature index f86bff5c9a..9ab1339e77 100644 --- a/x/ecocredit/server/basket/features/msg_create.feature +++ b/x/ecocredit/server/basket/features/msg_create.feature @@ -9,8 +9,8 @@ Feature: Msg/Create - when the basket includes a credit type that exists - when the basket criteria includes credit classes that exist - when the basket criteria includes credit classes that match the credit type - - when the exponent is greater than or equal to the credit type precision - the user token balance is updated and only the minimum fee is taken + - the basket denom is formatted with a prefix based on credit type precision - the response includes the basket denom Rule: The basket name must be unique @@ -145,24 +145,6 @@ Feature: Msg/Create When alice attempts to create a basket with credit type "C" and allowed class "BIO01" Then expect the error "basket specified credit type C, but class BIO01 is of type BIO: invalid request" - Rule: The basket exponent must be greater than or equal to the credit type precision - - Background: - Given a credit type with precision "6" - - Scenario Outline: basket exponent is greater than or equal to credit type precision - When alice attempts to create a basket with exponent "" - Then expect no error - - Examples: - | description | exponent | - | greater than | 9 | - | equal to | 6 | - - Scenario: basket exponent is less than credit type precision - When alice attempts to create a basket with exponent "3" - Then expect the error "exponent 3 must be >= credit type precision 6: invalid request" - Rule: The user token balance is updated and only the minimum fee is taken Background: @@ -181,13 +163,39 @@ Feature: Msg/Create # no failing scenario - state transitions only occur upon successful message execution - Rule: The message response includes basket denom when credits are put into the basket + Rule: The basket denom is formatted with a prefix based on credit type precision - Background: - Given a credit type with abbreviation "C" and precision "6" + Scenario Outline: basket denom is formatted using credit type precision + Given a credit type with abbreviation "C" and precision "" + When alice attempts to create a basket with name "NCT" and credit type "C" + Then expect the response + """ + { + "basket_denom": "" + } + """ + + Examples: + | description | precision | basket-denom | + | no prefix | 0 | eco.C.NCT | + | d (deci) | 1 | eco.dC.NCT | + | c (centi) | 2 | eco.cC.NCT | + | m (milli) | 3 | eco.mC.NCT | + | u (micro) | 6 | eco.uC.NCT | + | n (nano) | 9 | eco.nC.NCT | + | p (pico) | 12 | eco.pC.NCT | + | f (femto) | 15 | eco.fC.NCT | + | a (atto) | 18 | eco.aC.NCT | + | z (zepto) | 21 | eco.zC.NCT | + | y (yocto) | 24 | eco.yC.NCT | + + # no failing scenario - credit type precision should always be a valid SI prefix + + Rule: The message response includes basket denom Scenario: message response includes the basket denom - When alice attempts to create a basket with name "NCT" and exponent "6" + Given a credit type with abbreviation "C" and precision "6" + When alice attempts to create a basket with name "NCT" Then expect the response """ { diff --git a/x/ecocredit/server/basket/features/msg_put.feature b/x/ecocredit/server/basket/features/msg_put.feature index a16d148054..f0c958fcc4 100644 --- a/x/ecocredit/server/basket/features/msg_put.feature +++ b/x/ecocredit/server/basket/features/msg_put.feature @@ -19,21 +19,23 @@ Feature: Msg/Put Rule: The basket must exist Background: - Given alice owns credits + Given a credit type with abbreviation "C" and precision "6" + And alice owns credits Scenario: basket exists - Given a basket with denom "eco.C.NCT" - When alice attempts to put credits into basket with denom "eco.C.NCT" + Given a basket with denom "eco.uC.NCT" + When alice attempts to put credits into basket with denom "eco.uC.NCT" Then expect no error Scenario: basket does not exist - When alice attempts to put credits into basket with denom "eco.C.NCT" - Then expect the error "basket eco.C.NCT not found: not found" + When alice attempts to put credits into basket with denom "eco.uC.NCT" + Then expect the error "basket eco.uC.NCT not found: not found" Rule: The credit batch must exist Background: - Given a basket + Given a credit type with abbreviation "C" + And a basket Scenario: batch denom exists Given alice owns credits from credit batch "C01-001-20200101-20210101-001" @@ -47,7 +49,8 @@ Feature: Msg/Put Rule: The credit batch must be from a credit class that is allowed in the basket Background: - Given a basket with allowed credit class "C01" + Given a credit type with abbreviation "C" + And a basket with allowed credit class "C01" Scenario: credit class is allowed Given alice owns credits from credit batch "C01-001-20200101-20210101-001" @@ -62,7 +65,8 @@ Feature: Msg/Put Rule: The user must have a credit balance for the credits being put into the basket Background: - Given a basket + Given a credit type with abbreviation "C" + And a basket Scenario: user has a credit balance Given alice owns credits from credit batch "C01-001-20200101-20210101-001" @@ -77,7 +81,8 @@ Feature: Msg/Put Rule: The user must have a credit balance more than or equal to the credits being put into the basket Background: - Given a basket + Given a credit type + And a basket Scenario Outline: user owns more than or equal amount of credits being put into the basket Given alice owns credit amount "" @@ -97,33 +102,36 @@ Feature: Msg/Put Rule: Credit amount must not exceed maximum decimal places Scenario Outline: credit amount does not exceed maximum decimal places - Given a basket with exponent "" + Given a credit type with abbreviation "C" and precision "" + And a basket with credit type "C" And alice owns credit amount "" When alice attempts to put credit amount "" into the basket Then expect no error Examples: - | description | exponent | credit-amount | - | no decimals | 0 | 2 | - | one decimal | 1 | 2.5 | - | two decimals | 2 | 2.25 | + | description | precision | credit-amount | + | no decimals | 0 | 2 | + | one decimal | 1 | 2.5 | + | two decimals | 2 | 2.25 | Scenario Outline: credit amount exceeds maximum decimal places - Given a basket with exponent "" + Given a credit type with abbreviation "C" and precision "" + And a basket with credit type "C" And alice owns credit amount "" When alice attempts to put credit amount "" into the basket Then expect error contains "exceeds maximum decimal places" Examples: - | description | exponent | credit-amount | - | no decimals | 0 | 2.5 | - | one decimal | 1 | 2.25 | - | two decimals | 2 | 2.333 | + | description | precision | credit-amount | + | no decimals | 0 | 2.5 | + | one decimal | 1 | 2.25 | + | two decimals | 2 | 2.333 | Rule: Credits from a batch with a start date before basket minimum start date cannot be put into the basket Background: - Given a basket with minimum start date "2021-01-01" + Given a credit type + And a basket with minimum start date "2021-01-01" Scenario Outline: batch start date after or equal to minimum start date Given alice owns credits with start date "" @@ -143,7 +151,8 @@ Feature: Msg/Put Rule: Credits from a batch with a start date outside basket start date window cannot be put into the basket Background: - Given the block time "2022-01-01" + Given a credit type + And the block time "2022-01-01" And a basket with start date window "31536000" Scenario Outline: batch start date within or at the limit of basket start date window @@ -163,6 +172,9 @@ Feature: Msg/Put Rule: Credits from a batch with a start date before basket years in the past cannot be put into the basket + Background: + Given a credit type + Scenario Outline: batch start date after or equal to years in the past Given the block time "2022-04-01" And a basket with years in the past "10" @@ -195,7 +207,8 @@ Feature: Msg/Put Rule: The user credit balance is updated when credits are put into the basket Scenario: user credit balance is updated - Given a basket + Given a credit type + And a basket And alice owns credit amount "100" When alice attempts to put credit amount "100" into the basket Then expect alice credit balance amount "0" @@ -205,7 +218,8 @@ Feature: Msg/Put Rule: The basket credit balance is updated when credits are put into the basket Scenario: basket credit balance is updated - Given a basket + Given a credit type + And a basket And alice owns credit amount "100" When alice attempts to put credit amount "100" into the basket Then expect basket credit balance amount "100" @@ -215,41 +229,44 @@ Feature: Msg/Put Rule: The user token balance is updated when credits are put into the basket Scenario Outline: user token balance is updated - Given a basket with exponent "" + Given a credit type with abbreviation "C" and precision "" + And a basket with credit type "C" And alice owns credit amount "" And alice owns basket token amount "0" When alice attempts to put credit amount "" into the basket And expect alice basket token balance amount "" Examples: - | description | exponent | credit-amount | token-amount | - | exponent zero, amount whole | 0 | 2 | 2 | - | exponent non-zero, amount whole | 6 | 2 | 2000000 | - | exponent non-zero, amount decimal | 6 | 2.5 | 2500000 | + | description | precision | credit-amount | token-amount | + | precision zero, amount whole | 0 | 2 | 2 | + | precision non-zero, amount whole | 6 | 2 | 2000000 | + | precision non-zero, amount decimal | 6 | 2.5 | 2500000 | # no failing scenario - state transitions only occur upon successful message execution Rule: The basket token supply is updated when credits are put into the basket Scenario Outline: basket token supply is updated - Given a basket with exponent "" + Given a credit type with abbreviation "C" and precision "" + And a basket with credit type "C" And basket token supply amount "0" And alice owns credit amount "" When alice attempts to put credit amount "" into the basket Then expect basket token supply amount "" Examples: - | description | exponent | credit-amount | token-amount | - | exponent zero, amount whole | 0 | 2 | 2 | - | exponent non-zero, amount whole | 6 | 2 | 2000000 | - | exponent non-zero, amount decimal | 6 | 2.5 | 2500000 | + | description | precision | credit-amount | token-amount | + | precision zero, amount whole | 0 | 2 | 2 | + | precision non-zero, amount whole | 6 | 2 | 2000000 | + | precision non-zero, amount decimal | 6 | 2.5 | 2500000 | # no failing scenario - state transitions only occur upon successful message execution Rule: The message response includes basket token amount received when credits are put into the basket Scenario Outline: message response includes basket token amount received - Given a basket with exponent "" + Given a credit type with abbreviation "C" and precision "" + And a basket with credit type "C" And alice owns credit amount "" When alice attempts to put credit amount "" into the basket Then expect the response @@ -260,9 +277,9 @@ Feature: Msg/Put """ Examples: - | description | exponent | credit-amount | token-amount | - | exponent zero, amount whole | 0 | 2 | 2 | - | exponent non-zero, amount whole | 6 | 2 | 2000000 | - | exponent non-zero, amount decimal | 6 | 2.5 | 2500000 | + | description | precision | credit-amount | token-amount | + | precision zero, amount whole | 0 | 2 | 2 | + | precision non-zero, amount whole | 6 | 2 | 2000000 | + | precision non-zero, amount decimal | 6 | 2.5 | 2500000 | # no failing scenario - response should always be empty when message execution fails diff --git a/x/ecocredit/server/basket/features/msg_take.feature b/x/ecocredit/server/basket/features/msg_take.feature index 1b0de8b0a7..23a4640d6f 100644 --- a/x/ecocredit/server/basket/features/msg_take.feature +++ b/x/ecocredit/server/basket/features/msg_take.feature @@ -15,20 +15,24 @@ Feature: Msg/Take Rule: The basket must exist + Background: + Given a credit type with abbreviation "C" and precision "0" + Scenario: basket exists - Given a basket with denom "eco.C.NCT" - And alice owns tokens with denom "eco.C.NCT" - When alice attempts to take credits with basket denom "eco.C.NCT" + Given a basket with denom "eco.uC.NCT" + And alice owns tokens with denom "eco.uC.NCT" + When alice attempts to take credits with basket denom "eco.uC.NCT" Then expect no error Scenario: basket does not exist - When alice attempts to take credits with basket denom "eco.C.NCT" - Then expect the error "basket eco.C.NCT not found: not found" + When alice attempts to take credits with basket denom "eco.uC.NCT" + Then expect the error "basket eco.uC.NCT not found: not found" Rule: The user token balance must be greater than or equal to the token amount Background: - Given a basket + Given a credit type with abbreviation "C" and precision "6" + And a basket Scenario Outline: user token balance is greater than or equal to token amount Given alice owns basket token amount "" @@ -43,7 +47,7 @@ Feature: Msg/Take Scenario Outline: user token balance is less than token amount Given alice owns basket token amount "" When alice attempts to take credits with basket token amount "" - Then expect the error "insufficient balance for basket denom eco.C.NCT: insufficient funds" + Then expect the error "insufficient balance for basket denom eco.uC.NCT: insufficient funds" Examples: | description | token-balance | token-amount | @@ -52,6 +56,9 @@ Feature: Msg/Take Rule: The user must set retire on take to true if auto-retire is enabled + Background: + Given a credit type + Scenario Outline: basket auto-retire disabled Given a basket with disable auto retire "true" And alice owns basket tokens @@ -78,7 +85,8 @@ Feature: Msg/Take Rule: The user token balance is updated when credits are taken from the basket Scenario: user token balance is updated - Given a basket + Given a credit type + And a basket And alice owns basket token amount "100" When alice attempts to take credits with basket token amount "50" Then expect alice basket token balance amount "50" @@ -88,7 +96,8 @@ Feature: Msg/Take Rule: The basket token supply is updated when credits are taken from the basket Scenario: basket token supply is updated - Given a basket + Given a credit type + And a basket And basket token supply amount "100" And alice owns basket token amount "100" When alice attempts to take credits with basket token amount "50" @@ -99,7 +108,8 @@ Feature: Msg/Take Rule: The user credit balance is updated when credits are taken from the basket Scenario Outline: user retired credit balance is updated - Given a basket with exponent "" and disable auto retire "false" + Given a credit type with abbreviation "C" and precision "" + And a basket with credit type "C" and disable auto retire "false" And basket token supply amount "" And alice owns basket token amount "" When alice attempts to take credits with basket token amount "" and retire on take "true" @@ -107,13 +117,14 @@ Feature: Msg/Take And expect alice tradable credit balance amount "0" Examples: - | description | exponent | token-amount | retired-credits | - | exponent zero, credits whole | 0 | 2 | 2 | - | exponent non-zero, credits whole | 6 | 2000000 | 2.000000 | - | exponent non-zero, credits decimal | 6 | 2500000 | 2.500000 | + | description | precision | token-amount | retired-credits | + | precision zero, credits whole | 0 | 2 | 2 | + | precision non-zero, credits whole | 6 | 2000000 | 2.000000 | + | precision non-zero, credits decimal | 6 | 2500000 | 2.500000 | Scenario Outline: user tradable credit balance is updated - Given a basket with exponent "" and disable auto retire "true" + Given a credit type with abbreviation "C" and precision "" + And a basket with credit type "C" and disable auto retire "true" And basket token supply amount "" And alice owns basket token amount "" When alice attempts to take credits with basket token amount "" and retire on take "false" @@ -121,34 +132,36 @@ Feature: Msg/Take And expect alice retired credit balance amount "0" Examples: - | description | exponent | token-amount | tradable-credits | - | exponent zero, credits whole | 0 | 2 | 2 | - | exponent non-zero, credits whole | 6 | 2000000 | 2.000000 | - | exponent non-zero, credits decimal | 6 | 2500000 | 2.500000 | + | description | precision | token-amount | tradable-credits | + | precision zero, credits whole | 0 | 2 | 2 | + | precision non-zero, credits whole | 6 | 2000000 | 2.000000 | + | precision non-zero, credits decimal | 6 | 2500000 | 2.500000 | # no failing scenario - state transitions only occur upon successful message execution Rule: The basket credit balance is updated when credits are taken from the basket Scenario Outline: basket credit balance is updated - Given a basket with exponent "" and credit balance "100" + Given a credit type with abbreviation "C" and precision "" + And a basket with credit type "C" and credit balance "100" And basket token supply amount "" And alice owns basket token amount "" When alice attempts to take credits with basket token amount "" Then expect basket credit balance amount "" Examples: - | description | exponent | token-amount | credit-amount | - | exponent zero, credits whole | 0 | 2 | 98 | - | exponent non-zero, credits whole | 6 | 2000000 | 98.000000 | - | exponent non-zero, credits decimal | 6 | 2500000 | 97.500000 | + | description | precision | token-amount | credit-amount | + | precision zero, credits whole | 0 | 2 | 98 | + | precision non-zero, credits whole | 6 | 2000000 | 98.000000 | + | precision non-zero, credits decimal | 6 | 2500000 | 97.500000 | # no failing scenario - state transitions only occur upon successful message execution Rule: The message response includes the credits received when credits are taken from the basket Scenario Outline: message response includes basket token amount received - Given a basket with exponent "" and credit balance "100" + Given a credit type with abbreviation "C" and precision "" + And a basket with credit type "C" and credit balance "100" And basket token supply amount "" And alice owns basket token amount "" When alice attempts to take credits with basket token amount "" @@ -165,9 +178,9 @@ Feature: Msg/Take """ Examples: - | description | exponent | token-amount | credit-amount | - | exponent zero, credits whole | 0 | 2 | 2 | - | exponent non-zero, credits whole | 6 | 2000000 | 2.000000 | - | exponent non-zero, credits decimal | 6 | 2500000 | 2.500000 | + | description | precision | token-amount | credit-amount | + | precision zero, credits whole | 0 | 2 | 2 | + | precision non-zero, credits whole | 6 | 2000000 | 2.000000 | + | precision non-zero, credits decimal | 6 | 2500000 | 2.500000 | # no failing scenario - response should always be empty when message execution fails diff --git a/x/ecocredit/server/basket/msg_create.go b/x/ecocredit/server/basket/msg_create.go index 94ab6d984d..c3d90853e9 100644 --- a/x/ecocredit/server/basket/msg_create.go +++ b/x/ecocredit/server/basket/msg_create.go @@ -41,11 +41,14 @@ func (k Keeper) Create(ctx context.Context, msg *basket.MsgCreate) (*basket.MsgC return nil, err } - if err = k.validateCreditType(ctx, msg.CreditTypeAbbrev, msg.Exponent); err != nil { - return nil, err + creditType, err := k.coreStore.CreditTypeTable().Get(ctx, msg.CreditTypeAbbrev) + if err != nil { + return nil, sdkerrors.ErrInvalidRequest.Wrapf( + "could not get credit type with abbreviation %s: %s", msg.CreditTypeAbbrev, err.Error(), + ) } - denom, displayDenom, err := basket.FormatBasketDenom(msg.Name, msg.CreditTypeAbbrev, msg.Exponent) + denom, displayDenom, err := basket.FormatBasketDenom(msg.Name, msg.CreditTypeAbbrev, creditType.Precision) if err != nil { return nil, err } @@ -56,7 +59,7 @@ func (k Keeper) Create(ctx context.Context, msg *basket.MsgCreate) (*basket.MsgC DisableAutoRetire: msg.DisableAutoRetire, CreditTypeAbbrev: msg.CreditTypeAbbrev, DateCriteria: msg.DateCriteria.ToApi(), - Exponent: msg.Exponent, + Exponent: creditType.Precision, // exponent is no longer used but set until removed Name: msg.Name, }) if err != nil { @@ -68,9 +71,9 @@ func (k Keeper) Create(ctx context.Context, msg *basket.MsgCreate) (*basket.MsgC denomUnits := []*banktypes.DenomUnit{{ Denom: displayDenom, - Exponent: msg.Exponent, + Exponent: creditType.Precision, }} - if msg.Exponent != 0 { + if creditType.Precision != 0 { denomUnits = append(denomUnits, &banktypes.DenomUnit{ Denom: denom, }) @@ -93,23 +96,6 @@ func (k Keeper) Create(ctx context.Context, msg *basket.MsgCreate) (*basket.MsgC return &basket.MsgCreateResponse{BasketDenom: denom}, err } -// validateCreditType returns error if a given credit type abbreviation doesn't exist or -// it's precision is bigger then the requested exponent. -func (k Keeper) validateCreditType(ctx context.Context, abbreviation string, exponent uint32) error { - creditType, err := k.coreStore.CreditTypeTable().Get(ctx, abbreviation) - if err != nil { - return sdkerrors.ErrInvalidRequest.Wrapf("could not get credit type with abbreviation %s: %s", abbreviation, err.Error()) - } - if creditType.Precision > exponent { - return sdkerrors.ErrInvalidRequest.Wrapf( - "exponent %d must be >= credit type precision %d", - exponent, - creditType.Precision, - ) - } - return nil -} - // indexAllowedClasses checks that all `allowedClasses` both exist, and are of the specified credit type, then inserts // the class into the BasketClass table. func (k Keeper) indexAllowedClasses(ctx context.Context, basketID uint64, allowedClasses []string, creditTypeAbbrev string) error { diff --git a/x/ecocredit/server/basket/msg_create_test.go b/x/ecocredit/server/basket/msg_create_test.go index 397a21fd58..24955552ca 100644 --- a/x/ecocredit/server/basket/msg_create_test.go +++ b/x/ecocredit/server/basket/msg_create_test.go @@ -19,14 +19,14 @@ import ( type createSuite struct { *baseSuite - alice sdk.AccAddress - aliceBalance sdk.Coin - minBasketFee sdk.Coins - basketName string - basketExponent uint32 - creditTypeAbbrev string - res *basket.MsgCreateResponse - err error + alice sdk.AccAddress + aliceBalance sdk.Coin + minBasketFee sdk.Coins + basketName string + creditTypeAbbrev string + creditTypePrecision uint32 + res *basket.MsgCreateResponse + err error } func TestCreate(t *testing.T) { @@ -37,8 +37,8 @@ func (s *createSuite) Before(t gocuke.TestingT) { s.baseSuite = setupBase(t) s.alice = s.addrs[0] s.basketName = "NCT" - s.basketExponent = 6 s.creditTypeAbbrev = "C" + s.creditTypePrecision = 6 } func (s *createSuite) AMinimumBasketFee(a string) { @@ -51,6 +51,7 @@ func (s *createSuite) AMinimumBasketFee(a string) { func (s *createSuite) ACreditType() { err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ Abbreviation: s.creditTypeAbbrev, + Precision: s.creditTypePrecision, }) require.NoError(s.t, err) } @@ -58,6 +59,7 @@ func (s *createSuite) ACreditType() { func (s *createSuite) ACreditTypeWithAbbreviation(a string) { err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ Abbreviation: a, + Precision: s.creditTypePrecision, }) require.NoError(s.t, err) } @@ -66,9 +68,11 @@ func (s *createSuite) ACreditTypeWithPrecision(b string) { precision, err := strconv.ParseUint(b, 10, 32) require.NoError(s.t, err) + s.creditTypePrecision = uint32(precision) + err = s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ Abbreviation: s.creditTypeAbbrev, - Precision: uint32(precision), + Precision: s.creditTypePrecision, }) require.NoError(s.t, err) } @@ -77,9 +81,11 @@ func (s *createSuite) ACreditTypeWithAbbreviationAndPrecision(a string, b string precision, err := strconv.ParseUint(b, 10, 32) require.NoError(s.t, err) + s.creditTypePrecision = uint32(precision) + err = s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ Abbreviation: a, - Precision: uint32(precision), + Precision: s.creditTypePrecision, }) require.NoError(s.t, err) } @@ -114,244 +120,75 @@ func (s *createSuite) AliceAttemptsToCreateABasketWithFee(a string) { basketFee := sdk.NewCoins(coin) - var coins sdk.Coins - - s.paramsKeeper.EXPECT(). - Get(s.sdkCtx, core.KeyBasketCreationFee, &coins). - Do(func(ctx sdk.Context, key []byte, coins *sdk.Coins) { - *coins = s.minBasketFee - }). - Times(1) - - s.bankKeeper.EXPECT(). - GetBalance(s.sdkCtx, s.alice, coin.Denom). - Return(s.aliceBalance). - AnyTimes() // not expected on failed attempt - - s.distKeeper.EXPECT(). - FundCommunityPool(s.sdkCtx, s.minBasketFee, s.alice). - Do(func(sdk.Context, sdk.Coins, sdk.AccAddress) { - if s.minBasketFee != nil { - // simulate token balance update unavailable with mocks - s.aliceBalance = s.aliceBalance.Sub(s.minBasketFee[0]) - } - }). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SetDenomMetaData(s.sdkCtx, s.getDenomMetadata()). - AnyTimes() // not expected on failed attempt + s.createExpectCalls() s.res, s.err = s.k.Create(s.ctx, &basket.MsgCreate{ Curator: s.alice.String(), Name: s.basketName, - Exponent: s.basketExponent, Fee: basketFee, CreditTypeAbbrev: s.creditTypeAbbrev, }) } func (s *createSuite) AliceAttemptsToCreateABasketWithNoFee() { - var coins sdk.Coins - - s.paramsKeeper.EXPECT(). - Get(s.sdkCtx, core.KeyBasketCreationFee, &coins). - Do(func(ctx sdk.Context, key []byte, coins *sdk.Coins) { - *coins = s.minBasketFee - }). - Times(1) - - s.distKeeper.EXPECT(). - FundCommunityPool(s.sdkCtx, s.minBasketFee, s.alice). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SetDenomMetaData(s.sdkCtx, s.getDenomMetadata()). - AnyTimes() // not expected on failed attempt + s.createExpectCalls() s.res, s.err = s.k.Create(s.ctx, &basket.MsgCreate{ Curator: s.alice.String(), Name: s.basketName, - Exponent: s.basketExponent, CreditTypeAbbrev: s.creditTypeAbbrev, }) } func (s *createSuite) AliceAttemptsToCreateABasketWithCreditType(a string) { - var coins sdk.Coins - - s.paramsKeeper.EXPECT(). - Get(s.sdkCtx, core.KeyBasketCreationFee, &coins). - Do(func(ctx sdk.Context, key []byte, coins *sdk.Coins) { - *coins = s.minBasketFee - }). - Times(1) - - s.distKeeper.EXPECT(). - FundCommunityPool(s.sdkCtx, s.minBasketFee, s.alice). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SetDenomMetaData(s.sdkCtx, s.getDenomMetadata()). - AnyTimes() // not expected on failed attempt + s.createExpectCalls() s.res, s.err = s.k.Create(s.ctx, &basket.MsgCreate{ Curator: s.alice.String(), Name: s.basketName, - Exponent: s.basketExponent, CreditTypeAbbrev: a, }) } func (s *createSuite) AliceAttemptsToCreateABasketWithCreditTypeAndAllowedClass(a string, b string) { - var coins sdk.Coins - - s.paramsKeeper.EXPECT(). - Get(s.sdkCtx, core.KeyBasketCreationFee, &coins). - Do(func(ctx sdk.Context, key []byte, coins *sdk.Coins) { - *coins = s.minBasketFee - }). - Times(1) - - s.distKeeper.EXPECT(). - FundCommunityPool(s.sdkCtx, s.minBasketFee, s.alice). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SetDenomMetaData(s.sdkCtx, s.getDenomMetadata()). - AnyTimes() // not expected on failed attempt + s.createExpectCalls() s.res, s.err = s.k.Create(s.ctx, &basket.MsgCreate{ Curator: s.alice.String(), Name: s.basketName, - Exponent: s.basketExponent, CreditTypeAbbrev: a, AllowedClasses: []string{b}, }) } func (s *createSuite) AliceAttemptsToCreateABasketWithAllowedClass(a string) { - var coins sdk.Coins - - s.paramsKeeper.EXPECT(). - Get(s.sdkCtx, core.KeyBasketCreationFee, &coins). - Do(func(ctx sdk.Context, key []byte, coins *sdk.Coins) { - *coins = s.minBasketFee - }). - Times(1) - - s.distKeeper.EXPECT(). - FundCommunityPool(s.sdkCtx, s.minBasketFee, s.alice). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SetDenomMetaData(s.sdkCtx, s.getDenomMetadata()). - AnyTimes() // not expected on failed attempt + s.createExpectCalls() s.res, s.err = s.k.Create(s.ctx, &basket.MsgCreate{ Curator: s.alice.String(), Name: s.basketName, - Exponent: s.basketExponent, CreditTypeAbbrev: s.creditTypeAbbrev, AllowedClasses: []string{a}, }) } func (s *createSuite) AliceAttemptsToCreateABasketWithName(a string) { - var coins sdk.Coins - - s.paramsKeeper.EXPECT(). - Get(s.sdkCtx, core.KeyBasketCreationFee, &coins). - Do(func(ctx sdk.Context, key []byte, coins *sdk.Coins) { - *coins = s.minBasketFee - }). - Times(1) - - s.distKeeper.EXPECT(). - FundCommunityPool(s.sdkCtx, s.minBasketFee, s.alice). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SetDenomMetaData(s.sdkCtx, s.getDenomMetadata()). - AnyTimes() // not expected on failed attempt + s.createExpectCalls() s.res, s.err = s.k.Create(s.ctx, &basket.MsgCreate{ Curator: s.alice.String(), Name: a, - Exponent: s.basketExponent, CreditTypeAbbrev: s.creditTypeAbbrev, }) } -func (s *createSuite) AliceAttemptsToCreateABasketWithExponent(a string) { - exponent, err := strconv.ParseUint(a, 10, 32) - require.NoError(s.t, err) - - // set exponent for denom metadata - s.basketExponent = uint32(exponent) - - var coins sdk.Coins - - s.paramsKeeper.EXPECT(). - Get(s.sdkCtx, core.KeyBasketCreationFee, &coins). - Do(func(ctx sdk.Context, key []byte, coins *sdk.Coins) { - *coins = s.minBasketFee - }). - Times(1) - - s.distKeeper.EXPECT(). - FundCommunityPool(s.sdkCtx, s.minBasketFee, s.alice). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SetDenomMetaData(s.sdkCtx, s.getDenomMetadata()). - AnyTimes() // not expected on failed attempt - - s.res, s.err = s.k.Create(s.ctx, &basket.MsgCreate{ - Curator: s.alice.String(), - Name: s.basketName, - Exponent: uint32(exponent), - CreditTypeAbbrev: s.creditTypeAbbrev, - }) -} - -func (s *createSuite) AliceAttemptsToCreateABasketWithNameAndExponent(a string, b string) { - exponent, err := strconv.ParseUint(b, 10, 32) - require.NoError(s.t, err) - - // set exponent for denom metadata - s.basketExponent = uint32(exponent) - - var coins sdk.Coins - - s.paramsKeeper.EXPECT(). - Get(s.sdkCtx, core.KeyBasketCreationFee, &coins). - Do(func(ctx sdk.Context, key []byte, coins *sdk.Coins) { - *coins = s.minBasketFee - }). - Times(1) - - s.distKeeper.EXPECT(). - FundCommunityPool(s.sdkCtx, s.minBasketFee, s.alice). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SetDenomMetaData(s.sdkCtx, s.getDenomMetadata()). - AnyTimes() // not expected on failed attempt +func (s *createSuite) AliceAttemptsToCreateABasketWithNameAndCreditType(a string, b string) { + s.createExpectCalls() s.res, s.err = s.k.Create(s.ctx, &basket.MsgCreate{ Curator: s.alice.String(), Name: a, - Exponent: uint32(exponent), - CreditTypeAbbrev: s.creditTypeAbbrev, + CreditTypeAbbrev: b, }) } @@ -378,13 +215,46 @@ func (s *createSuite) ExpectTheResponse(a gocuke.DocString) { require.Equal(s.t, res, s.res) } +func (s *createSuite) createExpectCalls() { + var coins sdk.Coins + + s.paramsKeeper.EXPECT(). + Get(s.sdkCtx, core.KeyBasketCreationFee, &coins). + Do(func(ctx sdk.Context, key []byte, coins *sdk.Coins) { + *coins = s.minBasketFee + }). + AnyTimes() // not expected on failed attempt + + if s.minBasketFee != nil { + s.bankKeeper.EXPECT(). + GetBalance(s.sdkCtx, s.alice, s.minBasketFee[0].Denom). + Return(s.aliceBalance). + AnyTimes() // not expected on failed attempt + } + + s.distKeeper.EXPECT(). + FundCommunityPool(s.sdkCtx, s.minBasketFee, s.alice). + Do(func(sdk.Context, sdk.Coins, sdk.AccAddress) { + if s.minBasketFee != nil { + // simulate token balance update unavailable with mocks + s.aliceBalance = s.aliceBalance.Sub(s.minBasketFee[0]) + } + }). + Return(nil). + AnyTimes() // not expected on failed attempt + + s.bankKeeper.EXPECT(). + SetDenomMetaData(s.sdkCtx, s.getDenomMetadata()). + AnyTimes() // not expected on failed attempt +} + func (s *createSuite) getDenomMetadata() bank.Metadata { - denom, displayDenom, err := basket.FormatBasketDenom(s.basketName, s.creditTypeAbbrev, s.basketExponent) + denom, displayDenom, err := basket.FormatBasketDenom(s.basketName, s.creditTypeAbbrev, s.creditTypePrecision) require.NoError(s.t, err) denomUnits := []*bank.DenomUnit{{ Denom: displayDenom, - Exponent: s.basketExponent, + Exponent: s.creditTypePrecision, }} if denom != displayDenom { diff --git a/x/ecocredit/server/basket/msg_put.go b/x/ecocredit/server/basket/msg_put.go index 0575a1b1f9..899cfae6f8 100644 --- a/x/ecocredit/server/basket/msg_put.go +++ b/x/ecocredit/server/basket/msg_put.go @@ -33,6 +33,12 @@ func (k Keeper) Put(ctx context.Context, req *baskettypes.MsgPut) (*baskettypes. return nil, err } + // get the credit type + creditType, err := k.coreStore.CreditTypeTable().Get(ctx, basket.CreditTypeAbbrev) + if err != nil { + return nil, err + } + // keep track of the total amount of tokens to give to the depositor amountReceived := sdk.NewInt(0) sdkCtx := sdk.UnwrapSDKContext(ctx) @@ -50,19 +56,19 @@ func (k Keeper) Put(ctx context.Context, req *baskettypes.MsgPut) (*baskettypes. return nil, err } // get the amount of credits in dec - amt, err := regenmath.NewPositiveFixedDecFromString(credit.Amount, basket.Exponent) + amt, err := regenmath.NewPositiveFixedDecFromString(credit.Amount, creditType.Precision) if err != nil { return nil, err } // update the user and basket balances - if err = k.transferToBasket(ctx, ownerAddr, amt, basket, batch); err != nil { + if err = k.transferToBasket(ctx, ownerAddr, amt, basket.Id, batch, creditType.Precision); err != nil { if sdkerrors.ErrInsufficientFunds.Is(err) { return nil, ecocredit.ErrInsufficientCredits } return nil, err } // get the amount of basket tokens to give to the depositor - tokens, err := creditAmountToBasketCoins(amt, basket.Exponent, basket.BasketDenom) + tokens, err := creditAmountToBasketCoins(amt, creditType.Precision, basket.BasketDenom) if err != nil { return nil, err } @@ -159,7 +165,7 @@ func (k Keeper) canBasketAcceptCredit(ctx context.Context, basket *api.Basket, b } // transferToBasket moves credits from the user's tradable balance, into the basket's balance -func (k Keeper) transferToBasket(ctx context.Context, sender sdk.AccAddress, amt regenmath.Dec, basket *api.Basket, batch *ecoApi.Batch) error { +func (k Keeper) transferToBasket(ctx context.Context, sender sdk.AccAddress, amt regenmath.Dec, basketId uint64, batch *ecoApi.Batch, exponent uint32) error { // update user balance, subtracting from their tradable balance userBal, err := k.coreStore.BatchBalanceTable().Get(ctx, sender, batch.Key) if err != nil { @@ -180,11 +186,11 @@ func (k Keeper) transferToBasket(ctx context.Context, sender sdk.AccAddress, amt // update basket balance with amount sent, adding to the basket's balance. var bal *api.BasketBalance - bal, err = k.stateStore.BasketBalanceTable().Get(ctx, basket.Id, batch.Denom) + bal, err = k.stateStore.BasketBalanceTable().Get(ctx, basketId, batch.Denom) if err != nil { if ormerrors.IsNotFound(err) { bal = &api.BasketBalance{ - BasketId: basket.Id, + BasketId: basketId, BatchDenom: batch.Denom, Balance: amt.String(), BatchStartDate: batch.StartDate, @@ -193,7 +199,7 @@ func (k Keeper) transferToBasket(ctx context.Context, sender sdk.AccAddress, amt return err } } else { - newBalance, err := regenmath.NewPositiveFixedDecFromString(bal.Balance, basket.Exponent) + newBalance, err := regenmath.NewPositiveFixedDecFromString(bal.Balance, exponent) if err != nil { return err } diff --git a/x/ecocredit/server/basket/msg_put_test.go b/x/ecocredit/server/basket/msg_put_test.go index 952b63cb8a..3f18c1c0fa 100644 --- a/x/ecocredit/server/basket/msg_put_test.go +++ b/x/ecocredit/server/basket/msg_put_test.go @@ -23,16 +23,17 @@ import ( type putSuite struct { *baseSuite - alice sdk.AccAddress - aliceTokenBalance sdk.Coin - basketTokenSupply sdk.Coin - classId string - creditTypeAbbrev string - batchDenom string - basketDenom string - tradableCredits string - res *basket.MsgPutResponse - err error + alice sdk.AccAddress + aliceTokenBalance sdk.Coin + basketTokenSupply sdk.Coin + classId string + creditTypeAbbrev string + creditTypePrecision uint32 + batchDenom string + basketDenom string + tradableCredits string + res *basket.MsgPutResponse + err error } func TestPut(t *testing.T) { @@ -43,17 +44,18 @@ func (s *putSuite) Before(t gocuke.TestingT) { s.baseSuite = setupBase(t) s.alice = s.addrs[0] s.aliceTokenBalance = sdk.Coin{ - Denom: "eco.C.NCT", + Denom: "eco.uC.NCT", Amount: sdk.NewInt(100), } s.basketTokenSupply = sdk.Coin{ - Denom: "eco.C.NCT", + Denom: "eco.uC.NCT", Amount: sdk.NewInt(100), } s.classId = "C01" s.creditTypeAbbrev = "C" + s.creditTypePrecision = 6 s.batchDenom = "C01-001-20200101-20210101-001" - s.basketDenom = "eco.C.NCT" + s.basketDenom = "eco.uC.NCT" s.tradableCredits = "100" // set the denom regex for basket coins @@ -62,6 +64,38 @@ func (s *putSuite) Before(t gocuke.TestingT) { }) } +func (s *putSuite) ACreditType() { + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + Abbreviation: s.creditTypeAbbrev, + Precision: s.creditTypePrecision, + }) + require.NoError(s.t, err) +} + +func (s *putSuite) ACreditTypeWithAbbreviation(a string) { + s.creditTypeAbbrev = a + + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + Abbreviation: s.creditTypeAbbrev, + Precision: s.creditTypePrecision, + }) + require.NoError(s.t, err) +} + +func (s *putSuite) ACreditTypeWithAbbreviationAndPrecision(a string, b string) { + precision, err := strconv.ParseUint(b, 10, 32) + require.NoError(s.t, err) + + s.creditTypeAbbrev = a + s.creditTypePrecision = uint32(precision) + + err = s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + Abbreviation: s.creditTypeAbbrev, + Precision: s.creditTypePrecision, + }) + require.NoError(s.t, err) +} + func (s *putSuite) ABasket() { basketId, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ BasketDenom: s.basketDenom, @@ -76,14 +110,12 @@ func (s *putSuite) ABasket() { require.NoError(s.t, err) } -func (s *putSuite) ABasketWithExponent(a string) { - exponent, err := strconv.ParseUint(a, 10, 32) - require.NoError(s.t, err) +func (s *putSuite) ABasketWithCreditType(a string) { + s.creditTypeAbbrev = a basketId, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ BasketDenom: s.basketDenom, CreditTypeAbbrev: s.creditTypeAbbrev, - Exponent: uint32(exponent), }) require.NoError(s.t, err) @@ -352,26 +384,7 @@ func (s *putSuite) TheBlockTime(a string) { } func (s *putSuite) AliceAttemptsToPutCreditsIntoTheBasket() { - sendCoin := s.calculateExpectedCoin(s.tradableCredits) - sendCoins := sdk.NewCoins(sendCoin) - - s.bankKeeper.EXPECT(). - MintCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, string, sdk.Coins) { - // simulate token supply update unavailable with mocks - s.basketTokenSupply = s.basketTokenSupply.Add(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(s.sdkCtx, basket.BasketSubModuleName, s.alice, sendCoins). - Do(func(sdk.Context, string, sdk.AccAddress, sdk.Coins) { - // simulate token balance update unavailable with mocks - s.aliceTokenBalance = s.aliceTokenBalance.Add(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt + s.putExpectCalls() s.res, s.err = s.k.Put(s.ctx, &basket.MsgPut{ Owner: s.alice.String(), @@ -386,29 +399,9 @@ func (s *putSuite) AliceAttemptsToPutCreditsIntoTheBasket() { } func (s *putSuite) AliceAttemptsToPutCreditsIntoBasketWithDenom(a string) { - amount, ok := sdk.NewIntFromString(s.tradableCredits) - require.True(s.t, ok) + s.basketDenom = a - sendCoin := sdk.NewCoin(s.basketDenom, amount) - sendCoins := sdk.NewCoins(sendCoin) - - s.bankKeeper.EXPECT(). - MintCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, string, sdk.Coins) { - // simulate token supply update unavailable with mocks - s.basketTokenSupply = s.basketTokenSupply.Add(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(s.sdkCtx, basket.BasketSubModuleName, s.alice, sendCoins). - Do(func(sdk.Context, string, sdk.AccAddress, sdk.Coins) { - // simulate token balance update unavailable with mocks - s.aliceTokenBalance = s.aliceTokenBalance.Add(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt + s.putExpectCalls() s.res, s.err = s.k.Put(s.ctx, &basket.MsgPut{ Owner: s.alice.String(), @@ -423,26 +416,9 @@ func (s *putSuite) AliceAttemptsToPutCreditsIntoBasketWithDenom(a string) { } func (s *putSuite) AliceAttemptsToPutCreditAmountIntoTheBasket(a string) { - sendCoin := s.calculateExpectedCoin(a) - sendCoins := sdk.NewCoins(sendCoin) + s.tradableCredits = a - s.bankKeeper.EXPECT(). - MintCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, string, sdk.Coins) { - // simulate token supply update unavailable with mocks - s.basketTokenSupply = s.basketTokenSupply.Add(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(s.sdkCtx, basket.BasketSubModuleName, s.alice, sendCoins). - Do(func(sdk.Context, string, sdk.AccAddress, sdk.Coins) { - // simulate token balance update unavailable with mocks - s.aliceTokenBalance = s.aliceTokenBalance.Add(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt + s.putExpectCalls() s.res, s.err = s.k.Put(s.ctx, &basket.MsgPut{ Owner: s.alice.String(), @@ -457,26 +433,7 @@ func (s *putSuite) AliceAttemptsToPutCreditAmountIntoTheBasket(a string) { } func (s *putSuite) AliceAttemptsToPutCreditsFromCreditBatchIntoTheBasket(a string) { - sendCoin := s.calculateExpectedCoin(s.tradableCredits) - sendCoins := sdk.NewCoins(sendCoin) - - s.bankKeeper.EXPECT(). - MintCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, string, sdk.Coins) { - // simulate token supply update unavailable with mocks - s.basketTokenSupply = s.basketTokenSupply.Add(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SendCoinsFromModuleToAccount(s.sdkCtx, basket.BasketSubModuleName, s.alice, sendCoins). - Do(func(sdk.Context, string, sdk.AccAddress, sdk.Coins) { - // simulate token balance update unavailable with mocks - s.aliceTokenBalance = s.aliceTokenBalance.Add(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt + s.putExpectCalls() s.res, s.err = s.k.Put(s.ctx, &basket.MsgPut{ Owner: s.alice.String(), @@ -551,18 +508,41 @@ func (s *putSuite) ExpectTheResponse(a gocuke.DocString) { require.Equal(s.t, res, s.res) } +func (s *putSuite) putExpectCalls() { + sendCoin := s.calculateExpectedCoin(s.tradableCredits) + sendCoins := sdk.NewCoins(sendCoin) + + s.bankKeeper.EXPECT(). + MintCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). + Do(func(sdk.Context, string, sdk.Coins) { + // simulate token supply update unavailable with mocks + s.basketTokenSupply = s.basketTokenSupply.Add(sendCoin) + }). + Return(nil). + AnyTimes() // not expected on failed attempt + + s.bankKeeper.EXPECT(). + SendCoinsFromModuleToAccount(s.sdkCtx, basket.BasketSubModuleName, s.alice, sendCoins). + Do(func(sdk.Context, string, sdk.AccAddress, sdk.Coins) { + // simulate token balance update unavailable with mocks + s.aliceTokenBalance = s.aliceTokenBalance.Add(sendCoin) + }). + Return(nil). + AnyTimes() // not expected on failed attempt +} + func (s *putSuite) calculateExpectedCoin(amount string) sdk.Coin { - basket, err := s.stateStore.BasketTable().GetByBasketDenom(s.ctx, s.basketDenom) + creditType, err := s.coreStore.CreditTypeTable().Get(s.ctx, s.creditTypeAbbrev) require.NoError(s.t, err) - dec, err := math.NewPositiveFixedDecFromString(amount, basket.Exponent) + dec, err := math.NewPositiveFixedDecFromString(amount, creditType.Precision) if err != nil && strings.Contains(err.Error(), "exceeds maximum decimal places") { // expected coins irrelevant if amount exceeds maximum decimal places return sdk.NewCoin(s.basketDenom, sdk.NewInt(0)) } require.NoError(s.t, err) - tokenAmt, err := math.NewDecFinite(1, int32(basket.Exponent)).MulExact(dec) + tokenAmt, err := math.NewDecFinite(1, int32(creditType.Precision)).MulExact(dec) require.NoError(s.t, err) amtInt, err := tokenAmt.BigInt() diff --git a/x/ecocredit/server/basket/msg_take.go b/x/ecocredit/server/basket/msg_take.go index 0fdd96986d..b8349836cf 100644 --- a/x/ecocredit/server/basket/msg_take.go +++ b/x/ecocredit/server/basket/msg_take.go @@ -26,6 +26,11 @@ func (k Keeper) Take(ctx context.Context, msg *baskettypes.MsgTake) (*baskettype return nil, err } + creditType, err := k.coreStore.CreditTypeTable().Get(ctx, basket.CreditTypeAbbrev) + if err != nil { + return nil, err + } + retire := msg.RetireOnTake if !basket.DisableAutoRetire && !retire { return nil, ErrCantDisableRetire @@ -64,7 +69,7 @@ func (k Keeper) Take(ctx context.Context, msg *baskettypes.MsgTake) (*baskettype return nil, err } - multiplier := math.NewDecFinite(1, int32(basket.Exponent)) + multiplier := math.NewDecFinite(1, int32(creditType.Precision)) amountCreditsNeeded, err := amountBasketCreditsDec.QuoExact(multiplier) if err != nil { return nil, err diff --git a/x/ecocredit/server/basket/msg_take_test.go b/x/ecocredit/server/basket/msg_take_test.go index 40ade38dd1..6fea659c57 100644 --- a/x/ecocredit/server/basket/msg_take_test.go +++ b/x/ecocredit/server/basket/msg_take_test.go @@ -18,17 +18,18 @@ import ( type takeSuite struct { *baseSuite - alice sdk.AccAddress - aliceTokenBalance sdk.Coin - basketTokenSupply sdk.Coin - classId string - creditTypeAbbrev string - batchDenom string - basketDenom string - tokenAmount string - jurisdiction string - res *basket.MsgTakeResponse - err error + alice sdk.AccAddress + aliceTokenBalance sdk.Coin + basketTokenSupply sdk.Coin + classId string + creditTypeAbbrev string + creditTypePrecision uint32 + batchDenom string + basketDenom string + tokenAmount string + jurisdiction string + res *basket.MsgTakeResponse + err error } func TestTake(t *testing.T) { @@ -39,17 +40,18 @@ func (s *takeSuite) Before(t gocuke.TestingT) { s.baseSuite = setupBase(t) s.alice = s.addrs[0] s.aliceTokenBalance = sdk.Coin{ - Denom: "eco.C.NCT", + Denom: "eco.uC.NCT", Amount: sdk.NewInt(100), } s.basketTokenSupply = sdk.Coin{ - Denom: "eco.C.NCT", + Denom: "eco.uC.NCT", Amount: sdk.NewInt(100), } s.classId = "C01" s.creditTypeAbbrev = "C" + s.creditTypePrecision = 6 s.batchDenom = "C01-001-20200101-20210101-001" - s.basketDenom = "eco.C.NCT" + s.basketDenom = "eco.uC.NCT" s.tokenAmount = "100" s.jurisdiction = "US-WA" @@ -59,9 +61,42 @@ func (s *takeSuite) Before(t gocuke.TestingT) { }) } +func (s *takeSuite) ACreditType() { + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + Abbreviation: s.creditTypeAbbrev, + Precision: s.creditTypePrecision, + }) + require.NoError(s.t, err) +} + +func (s *takeSuite) ACreditTypeWithAbbreviation(a string) { + s.creditTypeAbbrev = a + + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + Abbreviation: s.creditTypeAbbrev, + Precision: s.creditTypePrecision, + }) + require.NoError(s.t, err) +} + +func (s *takeSuite) ACreditTypeWithAbbreviationAndPrecision(a string, b string) { + precision, err := strconv.ParseUint(b, 10, 32) + require.NoError(s.t, err) + + s.creditTypeAbbrev = a + s.creditTypePrecision = uint32(precision) + + err = s.coreStore.CreditTypeTable().Insert(s.ctx, &coreapi.CreditType{ + Abbreviation: s.creditTypeAbbrev, + Precision: s.creditTypePrecision, + }) + require.NoError(s.t, err) +} + func (s *takeSuite) ABasket() { basketId, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ - BasketDenom: s.basketDenom, + BasketDenom: s.basketDenom, + CreditTypeAbbrev: s.creditTypeAbbrev, }) require.NoError(s.t, err) @@ -70,8 +105,11 @@ func (s *takeSuite) ABasket() { } func (s *takeSuite) ABasketWithDenom(a string) { + s.basketDenom = a + basketId, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ - BasketDenom: a, + BasketDenom: s.basketDenom, + CreditTypeAbbrev: s.creditTypeAbbrev, }) require.NoError(s.t, err) @@ -85,6 +123,7 @@ func (s *takeSuite) ABasketWithDisableAutoRetire(a string) { basketId, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ BasketDenom: s.basketDenom, + CreditTypeAbbrev: s.creditTypeAbbrev, DisableAutoRetire: disableAutoRetire, }) require.NoError(s.t, err) @@ -95,23 +134,23 @@ func (s *takeSuite) ABasketWithDisableAutoRetire(a string) { func (s *takeSuite) ABasketWithCreditBalance(a string) { basketId, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ - BasketDenom: s.basketDenom, + BasketDenom: s.basketDenom, + CreditTypeAbbrev: s.creditTypeAbbrev, }) require.NoError(s.t, err) s.addBasketClassAndBalance(basketId, a) } -func (s *takeSuite) ABasketWithExponentAndDisableAutoRetire(a string, b string) { - exponent, err := strconv.ParseUint(a, 10, 32) - require.NoError(s.t, err) +func (s *takeSuite) ABasketWithCreditTypeAndDisableAutoRetire(a string, b string) { + s.creditTypeAbbrev = a disableAutoRetire, err := strconv.ParseBool(b) require.NoError(s.t, err) basketId, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ BasketDenom: s.basketDenom, - Exponent: uint32(exponent), + CreditTypeAbbrev: s.creditTypeAbbrev, DisableAutoRetire: disableAutoRetire, }) require.NoError(s.t, err) @@ -120,13 +159,12 @@ func (s *takeSuite) ABasketWithExponentAndDisableAutoRetire(a string, b string) s.addBasketClassAndBalance(basketId, s.tokenAmount) } -func (s *takeSuite) ABasketWithExponentAndCreditBalance(a string, b string) { - exponent, err := strconv.ParseUint(a, 10, 32) - require.NoError(s.t, err) +func (s *takeSuite) ABasketWithCreditTypeAndCreditBalance(a string, b string) { + s.creditTypeAbbrev = a basketId, err := s.stateStore.BasketTable().InsertReturningID(s.ctx, &api.Basket{ - BasketDenom: s.basketDenom, - Exponent: uint32(exponent), + BasketDenom: s.basketDenom, + CreditTypeAbbrev: s.creditTypeAbbrev, }) require.NoError(s.t, err) @@ -164,35 +202,13 @@ func (s *takeSuite) BasketTokenSupplyAmount(a string) { } func (s *takeSuite) AliceAttemptsToTakeCreditsWithBasketDenom(a string) { - sendCoin := s.aliceTokenBalance - sendCoins := sdk.NewCoins(sendCoin) - - s.bankKeeper.EXPECT(). - GetBalance(s.sdkCtx, s.alice, a). - Return(s.aliceTokenBalance). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SendCoinsFromAccountToModule(s.sdkCtx, s.alice, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, sdk.AccAddress, string, sdk.Coins) { - // simulate token balance update unavailable with mocks - s.aliceTokenBalance = s.aliceTokenBalance.Sub(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt + s.basketDenom = a - s.bankKeeper.EXPECT(). - BurnCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, string, sdk.Coins) { - // simulate token supply update unavailable with mocks - s.basketTokenSupply = s.basketTokenSupply.Sub(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt + s.takeExpectCalls() s.res, s.err = s.k.Take(s.ctx, &basket.MsgTake{ Owner: s.alice.String(), - BasketDenom: a, + BasketDenom: s.basketDenom, Amount: s.aliceTokenBalance.Amount.String(), RetirementJurisdiction: s.jurisdiction, RetireOnTake: true, // satisfy default auto-retire @@ -200,81 +216,31 @@ func (s *takeSuite) AliceAttemptsToTakeCreditsWithBasketDenom(a string) { } func (s *takeSuite) AliceAttemptsToTakeCreditsWithBasketTokenAmount(a string) { - amount, ok := sdk.NewIntFromString(a) - require.True(s.t, ok) + s.tokenAmount = a - sendCoin := sdk.NewCoin(s.basketDenom, amount) - sendCoins := sdk.NewCoins(sendCoin) - - s.bankKeeper.EXPECT(). - GetBalance(s.sdkCtx, s.alice, s.basketDenom). - Return(s.aliceTokenBalance). - Times(1) - - s.bankKeeper.EXPECT(). - SendCoinsFromAccountToModule(s.sdkCtx, s.alice, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, sdk.AccAddress, string, sdk.Coins) { - // simulate token balance update unavailable with mocks - s.aliceTokenBalance = s.aliceTokenBalance.Sub(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - BurnCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, string, sdk.Coins) { - // simulate token supply update unavailable with mocks - s.basketTokenSupply = s.basketTokenSupply.Sub(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt + s.takeExpectCalls() s.res, s.err = s.k.Take(s.ctx, &basket.MsgTake{ Owner: s.alice.String(), BasketDenom: s.basketDenom, - Amount: a, + Amount: s.tokenAmount, RetirementJurisdiction: s.jurisdiction, RetireOnTake: true, // satisfy default auto-retire }) } func (s *takeSuite) AliceAttemptsToTakeCreditsWithBasketTokenAmountAndRetireOnTake(a string, b string) { - amount, ok := sdk.NewIntFromString(a) - require.True(s.t, ok) + s.tokenAmount = a retireOnTake, err := strconv.ParseBool(b) require.NoError(s.t, err) - sendCoin := sdk.NewCoin(s.basketDenom, amount) - sendCoins := sdk.NewCoins(sendCoin) - - s.bankKeeper.EXPECT(). - GetBalance(s.sdkCtx, s.alice, s.basketDenom). - Return(s.aliceTokenBalance). - Times(1) - - s.bankKeeper.EXPECT(). - SendCoinsFromAccountToModule(s.sdkCtx, s.alice, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, sdk.AccAddress, string, sdk.Coins) { - // simulate token balance update unavailable with mocks - s.aliceTokenBalance = s.aliceTokenBalance.Sub(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - BurnCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, string, sdk.Coins) { - // simulate token supply update unavailable with mocks - s.basketTokenSupply = s.basketTokenSupply.Sub(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt + s.takeExpectCalls() s.res, s.err = s.k.Take(s.ctx, &basket.MsgTake{ Owner: s.alice.String(), BasketDenom: s.basketDenom, - Amount: a, + Amount: s.tokenAmount, RetirementJurisdiction: s.jurisdiction, RetireOnTake: retireOnTake, }) @@ -284,31 +250,7 @@ func (s *takeSuite) AliceAttemptsToTakeCreditsWithRetireOnTake(a string) { retireOnTake, err := strconv.ParseBool(a) require.NoError(s.t, err) - sendCoin := s.aliceTokenBalance - sendCoins := sdk.NewCoins(sendCoin) - - s.bankKeeper.EXPECT(). - GetBalance(s.sdkCtx, s.alice, s.basketDenom). - Return(s.aliceTokenBalance). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - SendCoinsFromAccountToModule(s.sdkCtx, s.alice, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, sdk.AccAddress, string, sdk.Coins) { - // simulate token balance update unavailable with mocks - s.aliceTokenBalance = s.aliceTokenBalance.Sub(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt - - s.bankKeeper.EXPECT(). - BurnCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). - Do(func(sdk.Context, string, sdk.Coins) { - // simulate token supply update unavailable with mocks - s.basketTokenSupply = s.basketTokenSupply.Sub(sendCoin) - }). - Return(nil). - AnyTimes() // not expected on failed attempt + s.takeExpectCalls() s.res, s.err = s.k.Take(s.ctx, &basket.MsgTake{ Owner: s.alice.String(), @@ -423,3 +365,34 @@ func (s *takeSuite) addBasketClassAndBalance(basketId uint64, creditAmount strin }) require.NoError(s.t, err) } + +func (s *takeSuite) takeExpectCalls() { + amount, ok := sdk.NewIntFromString(s.tokenAmount) + require.True(s.t, ok) + + sendCoin := sdk.NewCoin(s.basketDenom, amount) + sendCoins := sdk.NewCoins(sendCoin) + + s.bankKeeper.EXPECT(). + GetBalance(s.sdkCtx, s.alice, s.basketDenom). + Return(s.aliceTokenBalance). + AnyTimes() // not expected on failed attempt + + s.bankKeeper.EXPECT(). + SendCoinsFromAccountToModule(s.sdkCtx, s.alice, basket.BasketSubModuleName, sendCoins). + Do(func(sdk.Context, sdk.AccAddress, string, sdk.Coins) { + // simulate token balance update unavailable with mocks + s.aliceTokenBalance = s.aliceTokenBalance.Sub(sendCoin) + }). + Return(nil). + AnyTimes() // not expected on failed attempt + + s.bankKeeper.EXPECT(). + BurnCoins(s.sdkCtx, basket.BasketSubModuleName, sendCoins). + Do(func(sdk.Context, string, sdk.Coins) { + // simulate token supply update unavailable with mocks + s.basketTokenSupply = s.basketTokenSupply.Sub(sendCoin) + }). + Return(nil). + AnyTimes() // not expected on failed attempt +} diff --git a/x/ecocredit/server/basket/util_test.go b/x/ecocredit/server/basket/util_test.go index 1e727fc7ee..c29708d296 100644 --- a/x/ecocredit/server/basket/util_test.go +++ b/x/ecocredit/server/basket/util_test.go @@ -21,6 +21,12 @@ func TestGetBasketBalances(t *testing.T) { batchDenom1, classId1 := "C01-001-0000000-0000000-001", "C01" batchDenom2, classId2 := "C02-001-0000000-0000000-002", "C02" userStartingBalance, amtToDeposit := math.NewDecFromInt64(10), math.NewDecFromInt64(3) + + err := s.coreStore.CreditTypeTable().Insert(s.ctx, &ecoApi.CreditType{ + Abbreviation: "C", + }) + assert.NilError(t, err) + insertClass(t, s, "C01", "C") insertClass(t, s, "C02", "C") @@ -36,7 +42,7 @@ func TestGetBasketBalances(t *testing.T) { s.bankKeeper.EXPECT().MintCoins(gmAny, gmAny, gmAny).Return(nil).Times(3) s.bankKeeper.EXPECT().SendCoinsFromModuleToAccount(gmAny, gmAny, gmAny, gmAny).Return(nil).Times(3) - _, err := s.k.Put(s.ctx, &basket.MsgPut{ + _, err = s.k.Put(s.ctx, &basket.MsgPut{ Owner: s.addrs[0].String(), BasketDenom: "foo", Credits: []*basket.BasketCredit{