Add commands to create and get auctions #2

Merged
ashwin merged 4 commits from pm-auction-commands into main 2024-02-12 08:34:41 +00:00
6 changed files with 106 additions and 165 deletions
Showing only changes of commit 3493cf97cb - Show all commits

View File

@ -13,57 +13,6 @@ import (
sync "sync" sync "sync"
) )
var _ protoreflect.List = (*_GenesisState_2_list)(nil)
type _GenesisState_2_list struct {
list *[]*Auction
}
func (x *_GenesisState_2_list) Len() int {
if x.list == nil {
return 0
}
return len(*x.list)
}
func (x *_GenesisState_2_list) Get(i int) protoreflect.Value {
return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect())
}
func (x *_GenesisState_2_list) Set(i int, value protoreflect.Value) {
valueUnwrapped := value.Message()
concreteValue := valueUnwrapped.Interface().(*Auction)
(*x.list)[i] = concreteValue
}
func (x *_GenesisState_2_list) Append(value protoreflect.Value) {
valueUnwrapped := value.Message()
concreteValue := valueUnwrapped.Interface().(*Auction)
*x.list = append(*x.list, concreteValue)
}
func (x *_GenesisState_2_list) AppendMutable() protoreflect.Value {
v := new(Auction)
*x.list = append(*x.list, v)
return protoreflect.ValueOfMessage(v.ProtoReflect())
}
func (x *_GenesisState_2_list) Truncate(n int) {
for i := n; i < len(*x.list); i++ {
(*x.list)[i] = nil
}
*x.list = (*x.list)[:n]
}
func (x *_GenesisState_2_list) NewElement() protoreflect.Value {
v := new(Auction)
return protoreflect.ValueOfMessage(v.ProtoReflect())
}
func (x *_GenesisState_2_list) IsValid() bool {
return x.list != nil
}
var ( var (
md_GenesisState protoreflect.MessageDescriptor md_GenesisState protoreflect.MessageDescriptor
fd_GenesisState_params protoreflect.FieldDescriptor fd_GenesisState_params protoreflect.FieldDescriptor
@ -148,8 +97,8 @@ func (x *fastReflection_GenesisState) Range(f func(protoreflect.FieldDescriptor,
return return
} }
} }
if len(x.Auctions) != 0 { if x.Auctions != nil {
value := protoreflect.ValueOfList(&_GenesisState_2_list{list: &x.Auctions}) value := protoreflect.ValueOfMessage(x.Auctions.ProtoReflect())
if !f(fd_GenesisState_auctions, value) { if !f(fd_GenesisState_auctions, value) {
return return
} }
@ -172,7 +121,7 @@ func (x *fastReflection_GenesisState) Has(fd protoreflect.FieldDescriptor) bool
case "cerc.auction.v1.GenesisState.params": case "cerc.auction.v1.GenesisState.params":
return x.Params != nil return x.Params != nil
case "cerc.auction.v1.GenesisState.auctions": case "cerc.auction.v1.GenesisState.auctions":
return len(x.Auctions) != 0 return x.Auctions != nil
default: default:
if fd.IsExtension() { if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState")) panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState"))
@ -213,11 +162,8 @@ func (x *fastReflection_GenesisState) Get(descriptor protoreflect.FieldDescripto
value := x.Params value := x.Params
return protoreflect.ValueOfMessage(value.ProtoReflect()) return protoreflect.ValueOfMessage(value.ProtoReflect())
case "cerc.auction.v1.GenesisState.auctions": case "cerc.auction.v1.GenesisState.auctions":
if len(x.Auctions) == 0 { value := x.Auctions
return protoreflect.ValueOfList(&_GenesisState_2_list{}) return protoreflect.ValueOfMessage(value.ProtoReflect())
}
listValue := &_GenesisState_2_list{list: &x.Auctions}
return protoreflect.ValueOfList(listValue)
default: default:
if descriptor.IsExtension() { if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState")) panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState"))
@ -241,9 +187,7 @@ func (x *fastReflection_GenesisState) Set(fd protoreflect.FieldDescriptor, value
case "cerc.auction.v1.GenesisState.params": case "cerc.auction.v1.GenesisState.params":
x.Params = value.Message().Interface().(*Params) x.Params = value.Message().Interface().(*Params)
case "cerc.auction.v1.GenesisState.auctions": case "cerc.auction.v1.GenesisState.auctions":
lv := value.List() x.Auctions = value.Message().Interface().(*Auctions)
clv := lv.(*_GenesisState_2_list)
x.Auctions = *clv.list
default: default:
if fd.IsExtension() { if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState")) panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState"))
@ -271,10 +215,9 @@ func (x *fastReflection_GenesisState) Mutable(fd protoreflect.FieldDescriptor) p
return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) return protoreflect.ValueOfMessage(x.Params.ProtoReflect())
case "cerc.auction.v1.GenesisState.auctions": case "cerc.auction.v1.GenesisState.auctions":
if x.Auctions == nil { if x.Auctions == nil {
x.Auctions = []*Auction{} x.Auctions = new(Auctions)
} }
value := &_GenesisState_2_list{list: &x.Auctions} return protoreflect.ValueOfMessage(x.Auctions.ProtoReflect())
return protoreflect.ValueOfList(value)
default: default:
if fd.IsExtension() { if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState")) panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState"))
@ -292,8 +235,8 @@ func (x *fastReflection_GenesisState) NewField(fd protoreflect.FieldDescriptor)
m := new(Params) m := new(Params)
return protoreflect.ValueOfMessage(m.ProtoReflect()) return protoreflect.ValueOfMessage(m.ProtoReflect())
case "cerc.auction.v1.GenesisState.auctions": case "cerc.auction.v1.GenesisState.auctions":
list := []*Auction{} m := new(Auctions)
return protoreflect.ValueOfList(&_GenesisState_2_list{list: &list}) return protoreflect.ValueOfMessage(m.ProtoReflect())
default: default:
if fd.IsExtension() { if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState")) panic(fmt.Errorf("proto3 declared messages do not support extensions: cerc.auction.v1.GenesisState"))
@ -367,12 +310,10 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods {
l = options.Size(x.Params) l = options.Size(x.Params)
n += 1 + l + runtime.Sov(uint64(l)) n += 1 + l + runtime.Sov(uint64(l))
} }
if len(x.Auctions) > 0 { if x.Auctions != nil {
for _, e := range x.Auctions { l = options.Size(x.Auctions)
l = options.Size(e)
n += 1 + l + runtime.Sov(uint64(l)) n += 1 + l + runtime.Sov(uint64(l))
} }
}
if x.unknownFields != nil { if x.unknownFields != nil {
n += len(x.unknownFields) n += len(x.unknownFields)
} }
@ -402,9 +343,8 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods {
i -= len(x.unknownFields) i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields) copy(dAtA[i:], x.unknownFields)
} }
if len(x.Auctions) > 0 { if x.Auctions != nil {
for iNdEx := len(x.Auctions) - 1; iNdEx >= 0; iNdEx-- { encoded, err := options.Marshal(x.Auctions)
encoded, err := options.Marshal(x.Auctions[iNdEx])
if err != nil { if err != nil {
return protoiface.MarshalOutput{ return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals, NoUnkeyedLiterals: input.NoUnkeyedLiterals,
@ -417,7 +357,6 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods {
i-- i--
dAtA[i] = 0x12 dAtA[i] = 0x12
} }
}
if x.Params != nil { if x.Params != nil {
encoded, err := options.Marshal(x.Params) encoded, err := options.Marshal(x.Params)
if err != nil { if err != nil {
@ -546,8 +485,10 @@ func (x *fastReflection_GenesisState) ProtoMethods() *protoiface.Methods {
if postIndex > l { if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
} }
x.Auctions = append(x.Auctions, &Auction{}) if x.Auctions == nil {
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Auctions[len(x.Auctions)-1]); err != nil { x.Auctions = &Auctions{}
}
if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Auctions); err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
} }
iNdEx = postIndex iNdEx = postIndex
@ -606,7 +547,7 @@ type GenesisState struct {
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"`
Auctions []*Auction `protobuf:"bytes,2,rep,name=auctions,proto3" json:"auctions,omitempty"` Auctions *Auctions `protobuf:"bytes,2,opt,name=auctions,proto3" json:"auctions,omitempty"`
} }
func (x *GenesisState) Reset() { func (x *GenesisState) Reset() {
@ -636,7 +577,7 @@ func (x *GenesisState) GetParams() *Params {
return nil return nil
} }
func (x *GenesisState) GetAuctions() []*Auction { func (x *GenesisState) GetAuctions() *Auctions {
if x != nil { if x != nil {
return x.Auctions return x.Auctions
} }
@ -652,29 +593,30 @@ var file_cerc_auction_v1_genesis_proto_rawDesc = []byte{
0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa0, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa1, 0x01, 0x0a, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69,
0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x61, 0x75, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x61, 0x75,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42,
0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x59, 0x0a, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x5a, 0x0a,
0x08, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
0x18, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x19, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76,
0x31, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x23, 0xf2, 0xde, 0x1f, 0x1f, 0x6a, 0x31, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x23, 0xf2, 0xde, 0x1f, 0x1f,
0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20, 0x79, 0x6a, 0x73, 0x6f, 0x6e, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x20,
0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x52, 0x08, 0x79, 0x61, 0x6d, 0x6c, 0x3a, 0x22, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x52,
0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0xbd, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x08, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0xbd, 0x01, 0x0a, 0x13, 0x63, 0x6f,
0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x6d, 0x2e, 0x63, 0x65, 0x72, 0x63, 0x2e, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x76,
0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50,
0x5a, 0x3a, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65, 0x72, 0x01, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x2e, 0x76, 0x64, 0x62, 0x2e, 0x74, 0x6f, 0x2f, 0x63, 0x65,
0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x32, 0x64, 0x2f, 0x61, 0x72, 0x63, 0x2d, 0x69, 0x6f, 0x2f, 0x6c, 0x61, 0x63, 0x6f, 0x6e, 0x69, 0x63, 0x32, 0x64, 0x2f,
0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x65, 0x72, 0x63, 0x2f, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x76, 0x31, 0x3b, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x2f, 0x76, 0x31, 0x3b, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03,
0x41, 0x58, 0xaa, 0x02, 0x0f, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x0f, 0x43, 0x65, 0x72, 0x63, 0x2e, 0x41, 0x75, 0x63, 0x74, 0x69,
0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75, 0x63, 0x74, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0f, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75, 0x63,
0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1b, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1b, 0x43, 0x65, 0x72, 0x63, 0x5c, 0x41,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x75, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x41, 0x75, 0x63, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x11, 0x43, 0x65, 0x72, 0x63, 0x3a, 0x3a, 0x41, 0x75,
0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
} }
var ( var (
@ -693,11 +635,11 @@ var file_cerc_auction_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo,
var file_cerc_auction_v1_genesis_proto_goTypes = []interface{}{ var file_cerc_auction_v1_genesis_proto_goTypes = []interface{}{
(*GenesisState)(nil), // 0: cerc.auction.v1.GenesisState (*GenesisState)(nil), // 0: cerc.auction.v1.GenesisState
(*Params)(nil), // 1: cerc.auction.v1.Params (*Params)(nil), // 1: cerc.auction.v1.Params
(*Auction)(nil), // 2: cerc.auction.v1.Auction (*Auctions)(nil), // 2: cerc.auction.v1.Auctions
} }
var file_cerc_auction_v1_genesis_proto_depIdxs = []int32{ var file_cerc_auction_v1_genesis_proto_depIdxs = []int32{
1, // 0: cerc.auction.v1.GenesisState.params:type_name -> cerc.auction.v1.Params 1, // 0: cerc.auction.v1.GenesisState.params:type_name -> cerc.auction.v1.Params
2, // 1: cerc.auction.v1.GenesisState.auctions:type_name -> cerc.auction.v1.Auction 2, // 1: cerc.auction.v1.GenesisState.auctions:type_name -> cerc.auction.v1.Auctions
2, // [2:2] is the sub-list for method output_type 2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type 2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension type_name

View File

@ -10,5 +10,5 @@ option go_package = "git.vdb.to/cerc-io/laconic2d/x/auction";
// GenesisState defines the genesis state of the auction module // GenesisState defines the genesis state of the auction module
message GenesisState { message GenesisState {
Params params = 1 [(gogoproto.nullable) = false]; Params params = 1 [(gogoproto.nullable) = false];
repeated Auction auctions = 2 [(gogoproto.moretags) = "json:\"auctions\" yaml:\"auctions\""]; Auctions auctions = 2 [(gogoproto.moretags) = "json:\"auctions\" yaml:\"auctions\""];
} }

View File

@ -82,7 +82,10 @@ message QueryGetBondsByOwnerRequest {
// QueryGetBondsByOwnerResponse is response type for Query/GetBondsByOwner RPC Method // QueryGetBondsByOwnerResponse is response type for Query/GetBondsByOwner RPC Method
message QueryGetBondsByOwnerResponse { message QueryGetBondsByOwnerResponse {
repeated Bond bonds = 1 [(gogoproto.nullable) = false, (gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""]; repeated Bond bonds = 1 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "json:\"bonds\" yaml:\"bonds\""
];
// pagination defines the pagination in the response. // pagination defines the pagination in the response.
cosmos.base.query.v1beta1.PageResponse pagination = 2; cosmos.base.query.v1beta1.PageResponse pagination = 2;

View File

@ -3,14 +3,14 @@ package auction
func DefaultGenesisState() *GenesisState { func DefaultGenesisState() *GenesisState {
return &GenesisState{ return &GenesisState{
Params: DefaultParams(), Params: DefaultParams(),
Auctions: []*Auction{}, Auctions: &Auctions{Auctions: []Auction{}},
} }
} }
func NewGenesisState(params Params, auctions []*Auction) *GenesisState { func NewGenesisState(params Params, auctions []Auction) *GenesisState {
return &GenesisState{ return &GenesisState{
Params: params, Params: params,
Auctions: auctions, Auctions: &Auctions{Auctions: auctions},
} }
} }

View File

@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
// GenesisState defines the genesis state of the auction module // GenesisState defines the genesis state of the auction module
type GenesisState struct { type GenesisState struct {
Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
Auctions []*Auction `protobuf:"bytes,2,rep,name=auctions,proto3" json:"auctions,omitempty" json:"auctions" yaml:"auctions"` Auctions *Auctions `protobuf:"bytes,2,opt,name=auctions,proto3" json:"auctions,omitempty" json:"auctions" yaml:"auctions"`
} }
func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) Reset() { *m = GenesisState{} }
@ -69,7 +69,7 @@ func (m *GenesisState) GetParams() Params {
return Params{} return Params{}
} }
func (m *GenesisState) GetAuctions() []*Auction { func (m *GenesisState) GetAuctions() *Auctions {
if m != nil { if m != nil {
return m.Auctions return m.Auctions
} }
@ -83,23 +83,22 @@ func init() {
func init() { proto.RegisterFile("cerc/auction/v1/genesis.proto", fileDescriptor_7571460e3af58ef5) } func init() { proto.RegisterFile("cerc/auction/v1/genesis.proto", fileDescriptor_7571460e3af58ef5) }
var fileDescriptor_7571460e3af58ef5 = []byte{ var fileDescriptor_7571460e3af58ef5 = []byte{
// 242 bytes of a gzipped FileDescriptorProto // 240 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0x4e, 0x2d, 0x4a, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0x4e, 0x2d, 0x4a,
0xd6, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0xd6, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b,
0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x07, 0x49, 0xeb, 0x41, 0xa5, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x07, 0x49, 0xeb, 0x41, 0xa5,
0xf5, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x72, 0xfa, 0x20, 0x16, 0x44, 0x99, 0xf5, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x72, 0xfa, 0x20, 0x16, 0x44, 0x99,
0x14, 0x86, 0x29, 0x30, 0x1d, 0x60, 0x69, 0xa5, 0x05, 0x8c, 0x5c, 0x3c, 0xee, 0x10, 0x73, 0x83, 0x14, 0x86, 0x29, 0x30, 0x1d, 0x60, 0x69, 0xa5, 0x85, 0x8c, 0x5c, 0x3c, 0xee, 0x10, 0x73, 0x83,
0x4b, 0x12, 0x4b, 0x52, 0x85, 0x4c, 0xb9, 0xd8, 0x0a, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0x25, 0x18, 0x4b, 0x12, 0x4b, 0x52, 0x85, 0x4c, 0xb9, 0xd8, 0x0a, 0x12, 0x8b, 0x12, 0x73, 0x8b, 0x25, 0x18,
0x15, 0x18, 0x35, 0xb8, 0x8d, 0xc4, 0xf5, 0xd0, 0xec, 0xd1, 0x0b, 0x00, 0x4b, 0x3b, 0xb1, 0x9c, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0xc4, 0xf5, 0xd0, 0xec, 0xd1, 0x0b, 0x00, 0x4b, 0x3b, 0xb1, 0x9c,
0xb8, 0x27, 0xcf, 0x10, 0x04, 0x55, 0x2c, 0x14, 0xc9, 0xc5, 0x01, 0x55, 0x52, 0x2c, 0xc1, 0xa4, 0xb8, 0x27, 0xcf, 0x10, 0x04, 0x55, 0x2c, 0x14, 0xc5, 0xc5, 0x01, 0x55, 0x52, 0x2c, 0xc1, 0x04,
0xc0, 0xac, 0xc1, 0x6d, 0x24, 0x81, 0xa1, 0xd1, 0x11, 0xc2, 0x74, 0x52, 0xfe, 0x74, 0x4f, 0x5e, 0xd6, 0x28, 0x89, 0xa1, 0xd1, 0x11, 0xaa, 0xc0, 0x49, 0xf9, 0xd3, 0x3d, 0x79, 0xf9, 0xac, 0xe2,
0x3e, 0xab, 0x38, 0x3f, 0xcf, 0x4a, 0x09, 0xa6, 0x47, 0x49, 0xa1, 0x32, 0x31, 0x37, 0x07, 0x89, 0xfc, 0x3c, 0x2b, 0x25, 0x98, 0x26, 0x25, 0x85, 0xca, 0xc4, 0xdc, 0x1c, 0x24, 0x7e, 0x10, 0xdc,
0x1f, 0x04, 0x37, 0xce, 0xc9, 0xe1, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x3c, 0x27, 0x87, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71,
0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x52, 0x4b, 0xcf,
0xd4, 0xd2, 0x33, 0x4b, 0xf4, 0xca, 0x52, 0x92, 0xf4, 0x4a, 0xf2, 0xf5, 0x41, 0x96, 0xe9, 0x66, 0x2c, 0xd1, 0x2b, 0x4b, 0x49, 0xd2, 0x2b, 0xc9, 0xd7, 0x07, 0xd9, 0xa6, 0x9b, 0x99, 0xaf, 0x9f,
0xe6, 0xeb, 0xe7, 0x24, 0x26, 0xe7, 0xe7, 0x65, 0x26, 0x1b, 0xa5, 0xe8, 0x57, 0xc0, 0xbc, 0x9a, 0x93, 0x98, 0x9c, 0x9f, 0x97, 0x99, 0x6c, 0x94, 0xa2, 0x5f, 0x01, 0xf3, 0x6b, 0x12, 0x1b, 0xd8,
0xc4, 0x06, 0xf6, 0xab, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x69, 0xca, 0xb3, 0x2b, 0x52, 0x01, 0xb3, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1e, 0x3c, 0x5f, 0xc5, 0x53, 0x01, 0x00, 0x00,
0x00, 0x00,
} }
func (m *GenesisState) Marshal() (dAtA []byte, err error) { func (m *GenesisState) Marshal() (dAtA []byte, err error) {
@ -122,10 +121,9 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i _ = i
var l int var l int
_ = l _ = l
if len(m.Auctions) > 0 { if m.Auctions != nil {
for iNdEx := len(m.Auctions) - 1; iNdEx >= 0; iNdEx-- {
{ {
size, err := m.Auctions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) size, err := m.Auctions.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
return 0, err return 0, err
} }
@ -135,7 +133,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i-- i--
dAtA[i] = 0x12 dAtA[i] = 0x12
} }
}
{ {
size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) size, err := m.Params.MarshalToSizedBuffer(dAtA[:i])
if err != nil { if err != nil {
@ -168,12 +165,10 @@ func (m *GenesisState) Size() (n int) {
_ = l _ = l
l = m.Params.Size() l = m.Params.Size()
n += 1 + l + sovGenesis(uint64(l)) n += 1 + l + sovGenesis(uint64(l))
if len(m.Auctions) > 0 { if m.Auctions != nil {
for _, e := range m.Auctions { l = m.Auctions.Size()
l = e.Size()
n += 1 + l + sovGenesis(uint64(l)) n += 1 + l + sovGenesis(uint64(l))
} }
}
return n return n
} }
@ -274,8 +269,10 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error {
if postIndex > l { if postIndex > l {
return io.ErrUnexpectedEOF return io.ErrUnexpectedEOF
} }
m.Auctions = append(m.Auctions, &Auction{}) if m.Auctions == nil {
if err := m.Auctions[len(m.Auctions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { m.Auctions = &Auctions{}
}
if err := m.Auctions.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err return err
} }
iNdEx = postIndex iNdEx = postIndex

View File

@ -1,41 +1,40 @@
package keeper package keeper
import ( import (
"context"
"git.vdb.to/cerc-io/laconic2d/x/auction" "git.vdb.to/cerc-io/laconic2d/x/auction"
sdk "github.com/cosmos/cosmos-sdk/types"
) )
// InitGenesis initializes the module state from a genesis state. // InitGenesis initializes the module state from a genesis state.
func (k *Keeper) InitGenesis(ctx context.Context, data *auction.GenesisState) error { func (k *Keeper) InitGenesis(ctx sdk.Context, data *auction.GenesisState) error {
if err := k.Params.Set(ctx, data.Params); err != nil { if err := k.Params.Set(ctx, data.Params); err != nil {
return err return err
} }
// Save auctions in store. // Save auctions in store.
// for _, auction := range data.Auctions { for _, auction := range data.Auctions.Auctions {
// if err := k.Auctions.Set(ctx, auction.Id, *auction); err != nil { if err := k.Auctions.Set(ctx, auction.Id, auction); err != nil {
// return err return err
// } }
// } }
return nil return nil
} }
// ExportGenesis exports the module state to a genesis state. // ExportGenesis exports the module state to a genesis state.
func (k *Keeper) ExportGenesis(ctx context.Context) (*auction.GenesisState, error) { func (k *Keeper) ExportGenesis(ctx sdk.Context) (*auction.GenesisState, error) {
params, err := k.Params.Get(ctx) params, err := k.Params.Get(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
// auctions, err := k.ListAuctions(ctx) auctions, err := k.ListAuctions(ctx)
// if err != nil { if err != nil {
// return nil, err return nil, err
// } }
return &auction.GenesisState{ return &auction.GenesisState{
Params: params, Params: params,
// Auctions: auctions, Auctions: &auction.Auctions{Auctions: auctions},
}, nil }, nil
} }