regenerate auction type without on-chain bidding
parent
87e29c3dcc
commit
7ecb5a9fe8
1
go.mod
1
go.mod
|
@ -86,6 +86,7 @@ require (
|
|||
github.com/gorilla/handlers v1.5.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
|
||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
|
||||
github.com/gtank/merlin v0.1.1 // indirect
|
||||
github.com/gtank/ristretto255 v0.1.2 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -734,6 +734,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t
|
|||
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 h1:lLT7ZLSzGLI08vc9cpd+tYmNWjdKDqyr/2L+f6U12Fk=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
|
||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
|
||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
|
||||
github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
|
||||
|
|
|
@ -9,6 +9,6 @@ message Auction {
|
|||
string index = 1;
|
||||
string name = 2;
|
||||
string description = 3;
|
||||
repeated Bid bids = 4;
|
||||
Bid topBid = 4;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,13 +23,13 @@ func (k msgServer) NewAuction(goCtx context.Context, msg *types.MsgNewAuction) (
|
|||
Index: index,
|
||||
Name: msg.Name,
|
||||
Description: msg.Description,
|
||||
Bids: []*types.Bid{},
|
||||
TopBid: new(types.Bid),
|
||||
}
|
||||
|
||||
k.Keeper.SetAuction(ctx, auction)
|
||||
next.AuctionId++
|
||||
|
||||
k.Keeper.SetNextAuction(ctx, types.NextAuction{next.AuctionId})
|
||||
k.Keeper.SetNextAuction(ctx, types.NextAuction{AuctionId: next.AuctionId})
|
||||
|
||||
return &types.MsgNewAuctionResponse{
|
||||
AuctionId: strconv.FormatUint(next.AuctionId, 10),
|
||||
|
|
|
@ -26,7 +26,7 @@ type Auction struct {
|
|||
Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
|
||||
Bids []*Bid `protobuf:"bytes,4,rep,name=bids,proto3" json:"bids,omitempty"`
|
||||
TopBid *Bid `protobuf:"bytes,4,opt,name=topBid,proto3" json:"topBid,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Auction) Reset() { *m = Auction{} }
|
||||
|
@ -83,9 +83,9 @@ func (m *Auction) GetDescription() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
func (m *Auction) GetBids() []*Bid {
|
||||
func (m *Auction) GetTopBid() *Bid {
|
||||
if m != nil {
|
||||
return m.Bids
|
||||
return m.TopBid
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -97,20 +97,20 @@ func init() {
|
|||
func init() { proto.RegisterFile("cosmostest/auction.proto", fileDescriptor_631f6f59914101d9) }
|
||||
|
||||
var fileDescriptor_631f6f59914101d9 = []byte{
|
||||
// 200 bytes of a gzipped FileDescriptorProto
|
||||
// 202 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x48, 0xce, 0x2f, 0xce,
|
||||
0xcd, 0x2f, 0x2e, 0x49, 0x2d, 0x2e, 0xd1, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2b,
|
||||
0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x45, 0xc8, 0xe8, 0x21, 0x98, 0x52, 0x22, 0x48, 0x1a, 0x92,
|
||||
0x32, 0x53, 0x20, 0x8a, 0x95, 0x5a, 0x19, 0xb9, 0xd8, 0x1d, 0x21, 0xda, 0x85, 0x44, 0xb8, 0x58,
|
||||
0x32, 0x53, 0x20, 0x8a, 0x95, 0x3a, 0x19, 0xb9, 0xd8, 0x1d, 0x21, 0xda, 0x85, 0x44, 0xb8, 0x58,
|
||||
0x33, 0xf3, 0x52, 0x52, 0x2b, 0x24, 0x18, 0x15, 0x18, 0x35, 0x38, 0x83, 0x20, 0x1c, 0x21, 0x21,
|
||||
0x2e, 0x96, 0xbc, 0xc4, 0xdc, 0x54, 0x09, 0x26, 0xb0, 0x20, 0x98, 0x2d, 0xa4, 0xc0, 0xc5, 0x9d,
|
||||
0x92, 0x5a, 0x9c, 0x5c, 0x94, 0x59, 0x00, 0xd2, 0x28, 0xc1, 0x0c, 0x96, 0x42, 0x16, 0x12, 0xd2,
|
||||
0xe3, 0x62, 0x49, 0xca, 0x4c, 0x29, 0x96, 0x60, 0x51, 0x60, 0xd6, 0xe0, 0x36, 0x92, 0xd2, 0xc3,
|
||||
0xea, 0x26, 0x3d, 0xa7, 0xcc, 0x94, 0x20, 0xb0, 0x3a, 0x27, 0x8b, 0x13, 0x8f, 0xe4, 0x18, 0x2f,
|
||||
0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18,
|
||||
0x6e, 0x3c, 0x96, 0x63, 0x88, 0x92, 0x83, 0xa8, 0xd7, 0x05, 0x3b, 0xbc, 0x42, 0x1f, 0xc9, 0x17,
|
||||
0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x8f, 0x18, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff,
|
||||
0x94, 0x35, 0x9e, 0x85, 0x11, 0x01, 0x00, 0x00,
|
||||
0x92, 0x5a, 0x9c, 0x5c, 0x94, 0x59, 0x00, 0xd2, 0x28, 0xc1, 0x0c, 0x96, 0x42, 0x16, 0x12, 0x32,
|
||||
0xe2, 0x62, 0x2b, 0xc9, 0x2f, 0x70, 0xca, 0x4c, 0x91, 0x60, 0x51, 0x60, 0xd4, 0xe0, 0x36, 0x92,
|
||||
0xd2, 0xc3, 0xea, 0x2a, 0x3d, 0xa7, 0xcc, 0x94, 0x20, 0xa8, 0x4a, 0x27, 0x8b, 0x13, 0x8f, 0xe4,
|
||||
0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f,
|
||||
0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x92, 0x83, 0xe8, 0xd0, 0x05, 0x3b, 0xbe, 0x42, 0x1f,
|
||||
0xc9, 0x27, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xcf, 0x18, 0x03, 0x02, 0x00, 0x00,
|
||||
0xff, 0xff, 0xe9, 0x88, 0x26, 0x2e, 0x15, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *Auction) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -133,19 +133,17 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Bids) > 0 {
|
||||
for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- {
|
||||
{
|
||||
size, err := m.Bids[iNdEx].MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i -= size
|
||||
i = encodeVarintAuction(dAtA, i, uint64(size))
|
||||
if m.TopBid != nil {
|
||||
{
|
||||
size, err := m.TopBid.MarshalToSizedBuffer(dAtA[:i])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
i -= size
|
||||
i = encodeVarintAuction(dAtA, i, uint64(size))
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x22
|
||||
}
|
||||
if len(m.Description) > 0 {
|
||||
i -= len(m.Description)
|
||||
|
@ -200,11 +198,9 @@ func (m *Auction) Size() (n int) {
|
|||
if l > 0 {
|
||||
n += 1 + l + sovAuction(uint64(l))
|
||||
}
|
||||
if len(m.Bids) > 0 {
|
||||
for _, e := range m.Bids {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovAuction(uint64(l))
|
||||
}
|
||||
if m.TopBid != nil {
|
||||
l = m.TopBid.Size()
|
||||
n += 1 + l + sovAuction(uint64(l))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
@ -342,7 +338,7 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
|
|||
iNdEx = postIndex
|
||||
case 4:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field TopBid", wireType)
|
||||
}
|
||||
var msglen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
|
@ -369,8 +365,10 @@ func (m *Auction) Unmarshal(dAtA []byte) error {
|
|||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.Bids = append(m.Bids, &Bid{})
|
||||
if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
if m.TopBid == nil {
|
||||
m.TopBid = &Bid{}
|
||||
}
|
||||
if err := m.TopBid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
|
|
Loading…
Reference in New Issue