diff --git a/go/node/deployment/v1beta3/resourceunit.pb.go b/go/node/deployment/v1beta3/resourceunit.pb.go index 9bbbe3aa..39c5cdbc 100644 --- a/go/node/deployment/v1beta3/resourceunit.pb.go +++ b/go/node/deployment/v1beta3/resourceunit.pb.go @@ -106,13 +106,43 @@ var fileDescriptor_fb431767d5aa2e0f = []byte{ 0x16, 0xb6, 0xa5, 0xdb, 0xd6, 0x36, 0x35, 0x7a, 0x81, 0x96, 0xad, 0x3b, 0xb3, 0x95, 0xe5, 0x2c, 0xa6, 0xf6, 0x6f, 0xd5, 0xe8, 0x0c, 0xeb, 0xab, 0x0e, 0x2b, 0x0d, 0xf0, 0x2d, 0x8d, 0x6f, 0x80, 0x71, 0xbf, 0x5b, 0x15, 0xaa, 0x22, 0x95, 0x65, 0x1f, 0xa9, 0x46, 0x2f, 0xd0, 0xf2, 0xe8, 0xcf, - 0xc7, 0xab, 0x6b, 0xf8, 0x0f, 0x8b, 0x95, 0x83, 0x96, 0x2b, 0x07, 0xbd, 0xaf, 0x1c, 0xf4, 0xb2, - 0x76, 0x8c, 0xe5, 0xda, 0x31, 0xde, 0xd6, 0x8e, 0xf1, 0x78, 0x9d, 0x30, 0x39, 0x29, 0x22, 0x1c, - 0x43, 0x4a, 0xd4, 0xfd, 0x97, 0x9c, 0xca, 0x67, 0xc8, 0xa7, 0xf5, 0x14, 0x66, 0x8c, 0x24, 0x40, - 0x38, 0x8c, 0xe9, 0x0f, 0xcf, 0x1b, 0xfd, 0x55, 0xbf, 0x77, 0xf8, 0x15, 0x00, 0x00, 0xff, 0xff, - 0xf8, 0x9f, 0xec, 0xd3, 0x01, 0x02, 0x00, 0x00, + 0xc7, 0xab, 0x8b, 0xfc, 0x87, 0xc5, 0xca, 0x41, 0xcb, 0x95, 0x83, 0xde, 0x57, 0x0e, 0x7a, 0x59, + 0x3b, 0xc6, 0x72, 0xed, 0x18, 0x6f, 0x6b, 0xc7, 0x78, 0xbc, 0x4e, 0x98, 0x9c, 0x14, 0x11, 0x8e, + 0x21, 0x25, 0xea, 0xfe, 0x4b, 0x4e, 0xe5, 0x33, 0xe4, 0xd3, 0x7a, 0x0a, 0x33, 0x46, 0x12, 0x20, + 0x1c, 0xc6, 0xf4, 0x87, 0xe7, 0x8d, 0xfe, 0xaa, 0xdf, 0x3b, 0xfc, 0x0a, 0x00, 0x00, 0xff, 0xff, + 0xaf, 0x0a, 0x29, 0xb9, 0x01, 0x02, 0x00, 0x00, } +func (this *ResourceUnit) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ResourceUnit) + if !ok { + that2, ok := that.(ResourceUnit) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Resources.Equal(&that1.Resources) { + return false + } + if this.Count != that1.Count { + return false + } + if !this.Price.Equal(&that1.Price) { + return false + } + return true +} func (m *ResourceUnit) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) diff --git a/go/node/market/v1beta3/errors.go b/go/node/market/v1beta3/errors.go index 31a563a2..044de7d7 100644 --- a/go/node/market/v1beta3/errors.go +++ b/go/node/market/v1beta3/errors.go @@ -1,7 +1,7 @@ package v1beta3 import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "errors" ) const ( @@ -41,67 +41,67 @@ const ( var ( // ErrEmptyProvider is the error when provider is empty - ErrEmptyProvider = sdkerrors.Register(ModuleName, errCodeEmptyProvider, "empty provider") + ErrEmptyProvider = errors.New("empty provider") // ErrSameAccount is the error when owner and provider are the same account - ErrSameAccount = sdkerrors.Register(ModuleName, errCodeSameAccount, "owner and provider are the same account") + ErrSameAccount = errors.New("owner and provider are the same account") // ErrInternal is the error for internal error - ErrInternal = sdkerrors.Register(ModuleName, errCodeInternal, "internal error") + ErrInternal = errors.New("internal error") // ErrBidOverOrder is the error when bid price is above max order price - ErrBidOverOrder = sdkerrors.Register(ModuleName, errCodeOverOrder, "bid price above max order price") + ErrBidOverOrder = errors.New("bid price above max order price") // ErrAttributeMismatch is the error for attribute mismatch - ErrAttributeMismatch = sdkerrors.Register(ModuleName, errCodeAttributeMismatch, "attribute mismatch") + ErrAttributeMismatch = errors.New("attribute mismatch") // ErrCapabilitiesMismatch is the error for capabilities mismatch - ErrCapabilitiesMismatch = sdkerrors.Register(ModuleName, errCodeCapabilitiesMismatch, "capabilities mismatch") + ErrCapabilitiesMismatch = errors.New("capabilities mismatch") // ErrUnknownBid is the error for unknown bid - ErrUnknownBid = sdkerrors.Register(ModuleName, errCodeUnknownBid, "unknown bid") + ErrUnknownBid = errors.New("unknown bid") // ErrUnknownLease is the error for unknown bid - ErrUnknownLease = sdkerrors.Register(ModuleName, errCodeUnknownLease, "unknown lease") + ErrUnknownLease = errors.New("unknown lease") // ErrUnknownLeaseForBid is the error when lease is unknown for bid - ErrUnknownLeaseForBid = sdkerrors.Register(ModuleName, errCodeUnknownLeaseForOrder, "unknown lease for bid") + ErrUnknownLeaseForBid = errors.New("unknown lease for bid") // ErrUnknownOrderForBid is the error when order is unknown for bid - ErrUnknownOrderForBid = sdkerrors.Register(ModuleName, errCodeUnknownOrderForBid, "unknown order for bid") + ErrUnknownOrderForBid = errors.New("unknown order for bid") // ErrLeaseNotActive is the error when lease is not active - ErrLeaseNotActive = sdkerrors.Register(ModuleName, errCodeLeaseNotActive, "lease not active") + ErrLeaseNotActive = errors.New("lease not active") // ErrBidNotActive is the error when bid is not matched - ErrBidNotActive = sdkerrors.Register(ModuleName, errCodeBidNotActive, "bid not active") + ErrBidNotActive = errors.New("bid not active") // ErrBidNotOpen is the error when bid is not matched - ErrBidNotOpen = sdkerrors.Register(ModuleName, errCodeBidNotOpen, "bid not open") + ErrBidNotOpen = errors.New("bid not open") // ErrNoLeaseForOrder is the error when there is no lease for order - ErrNoLeaseForOrder = sdkerrors.Register(ModuleName, errCodeNoLeaseForOrder, "no lease for order") + ErrNoLeaseForOrder = errors.New("no lease for order") // ErrOrderNotFound order not found - ErrOrderNotFound = sdkerrors.Register(ModuleName, errCodeOrderNotFound, "invalid order: order not found") + ErrOrderNotFound = errors.New("invalid order: order not found") // ErrGroupNotFound order not found - ErrGroupNotFound = sdkerrors.Register(ModuleName, errCodeGroupNotFound, "order not found") + ErrGroupNotFound = errors.New("order not found") // ErrGroupNotOpen order not found - ErrGroupNotOpen = sdkerrors.Register(ModuleName, errCodeGroupNotOpen, "order not open") + ErrGroupNotOpen = errors.New("order not open") // ErrOrderNotOpen order not found - ErrOrderNotOpen = sdkerrors.Register(ModuleName, errCodeOrderNotOpen, "bid: order not open") + ErrOrderNotOpen = errors.New("bid: order not open") // ErrBidNotFound bid not found - ErrBidNotFound = sdkerrors.Register(ModuleName, errCodeBidNotFound, "invalid bid: bid not found") + ErrBidNotFound = errors.New("invalid bid: bid not found") // ErrBidZeroPrice zero price - ErrBidZeroPrice = sdkerrors.Register(ModuleName, errCodeBidZeroPrice, "invalid bid: zero price") + ErrBidZeroPrice = errors.New("invalid bid: zero price") // ErrLeaseNotFound lease not found - ErrLeaseNotFound = sdkerrors.Register(ModuleName, errCodeLeaseNotFound, "invalid lease: lease not found") + ErrLeaseNotFound = errors.New("invalid lease: lease not found") // ErrBidExists bid exists - ErrBidExists = sdkerrors.Register(ModuleName, errCodeBidExists, "invalid bid: bid exists from provider") + ErrBidExists = errors.New("invalid bid: bid exists from provider") // ErrBidInvalidPrice bid invalid price - ErrBidInvalidPrice = sdkerrors.Register(ModuleName, errCodeInvalidPrice, "bid price is invalid") + ErrBidInvalidPrice = errors.New("bid price is invalid") // ErrOrderActive order active - ErrOrderActive = sdkerrors.New(ModuleName, errCodeOrderActive, "order active") + ErrOrderActive = errors.New("order active") // ErrOrderClosed order closed - ErrOrderClosed = sdkerrors.New(ModuleName, errCodeOrderClosed, "order closed") + ErrOrderClosed = errors.New("order closed") // ErrOrderExists indicates a new order was proposed overwrite the existing store key - ErrOrderExists = sdkerrors.New(ModuleName, errCodeOrderExists, "order already exists in store") + ErrOrderExists = errors.New("order already exists in store") // ErrOrderTooEarly to match bid - ErrOrderTooEarly = sdkerrors.New(ModuleName, errCodeOrderTooEarly, "order: chain height to low for bidding") + ErrOrderTooEarly = errors.New("order: chain height to low for bidding") // ErrOrderDurationExceeded order should be closed - ErrOrderDurationExceeded = sdkerrors.New(ModuleName, errCodeOrderDurationExceeded, "order duration has exceeded the bidding duration") + ErrOrderDurationExceeded = errors.New("order duration has exceeded the bidding duration") // ErrInvalidDeposit indicates an invalid deposit - ErrInvalidDeposit = sdkerrors.Register(ModuleName, errInvalidDeposit, "Deposit invalid") + ErrInvalidDeposit = errors.New("deposit invalid") // ErrInvalidParam indicates an invalid chain parameter - ErrInvalidParam = sdkerrors.Register(ModuleName, errInvalidParam, "parameter invalid") + ErrInvalidParam = errors.New("parameter invalid") // ErrUnknownProvider indicates an invalid chain parameter - ErrUnknownProvider = sdkerrors.Register(ModuleName, errUnknownProvider, "unknown provider") + ErrUnknownProvider = errors.New("unknown provider") // ErrInvalidBid indicates an invalid chain parameter - ErrInvalidBid = sdkerrors.Register(ModuleName, errInvalidBid, "unknown provider") + ErrInvalidBid = errors.New("unknown provider") ) diff --git a/go/node/market/v1beta4/bid.go b/go/node/market/v1beta4/bid.go new file mode 100644 index 00000000..f4a65c38 --- /dev/null +++ b/go/node/market/v1beta4/bid.go @@ -0,0 +1,38 @@ +package v1beta4 + +import ( + "sort" +) + +type ResourcesOffer []ResourceOffer + +var _ sort.Interface = (*ResourcesOffer)(nil) + +func (r *ResourceOffer) Dup() ResourceOffer { + return ResourceOffer{ + Resources: r.Resources.Dup(), + Count: r.Count, + } +} + +func (s ResourcesOffer) Len() int { + return len(s) +} + +func (s ResourcesOffer) Swap(i, j int) { + s[i], s[j] = s[j], s[i] +} + +func (s ResourcesOffer) Less(i, j int) bool { + return s[i].Resources.ID < s[j].Resources.ID +} + +func (s ResourcesOffer) Dup() ResourcesOffer { + res := make(ResourcesOffer, 0, len(s)) + + for _, ru := range s { + res = append(res, ru.Dup()) + } + + return s +} diff --git a/go/node/market/v1beta4/bid.pb.go b/go/node/market/v1beta4/bid.pb.go new file mode 100644 index 00000000..37d581df --- /dev/null +++ b/go/node/market/v1beta4/bid.pb.go @@ -0,0 +1,2337 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: akash/market/v1beta4/bid.proto + +package v1beta4 + +import ( + fmt "fmt" + v1beta3 "github.com/akash-network/akash-api/go/node/types/v1beta3" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// State is an enum which refers to state of bid +type Bid_State int32 + +const ( + // Prefix should start with 0 in enum. So declaring dummy state + BidStateInvalid Bid_State = 0 + // BidOpen denotes state for bid open + BidOpen Bid_State = 1 + // BidMatched denotes state for bid open + BidActive Bid_State = 2 + // BidLost denotes state for bid lost + BidLost Bid_State = 3 + // BidClosed denotes state for bid closed + BidClosed Bid_State = 4 +) + +var Bid_State_name = map[int32]string{ + 0: "invalid", + 1: "open", + 2: "active", + 3: "lost", + 4: "closed", +} + +var Bid_State_value = map[string]int32{ + "invalid": 0, + "open": 1, + "active": 2, + "lost": 3, + "closed": 4, +} + +func (x Bid_State) String() string { + return proto.EnumName(Bid_State_name, int32(x)) +} + +func (Bid_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_c19fff42684bf143, []int{6, 0} +} + +// ResourceOffer describes resources that provider is offering +// for deployment +type ResourceOffer struct { + Resources v1beta3.Resources `protobuf:"bytes,1,opt,name=resources,proto3" json:"resources" yaml:"resources"` + Count uint32 `protobuf:"varint,2,opt,name=count,proto3" json:"count" yaml:"count"` +} + +func (m *ResourceOffer) Reset() { *m = ResourceOffer{} } +func (m *ResourceOffer) String() string { return proto.CompactTextString(m) } +func (*ResourceOffer) ProtoMessage() {} +func (*ResourceOffer) Descriptor() ([]byte, []int) { + return fileDescriptor_c19fff42684bf143, []int{0} +} +func (m *ResourceOffer) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ResourceOffer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ResourceOffer.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ResourceOffer) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResourceOffer.Merge(m, src) +} +func (m *ResourceOffer) XXX_Size() int { + return m.Size() +} +func (m *ResourceOffer) XXX_DiscardUnknown() { + xxx_messageInfo_ResourceOffer.DiscardUnknown(m) +} + +var xxx_messageInfo_ResourceOffer proto.InternalMessageInfo + +func (m *ResourceOffer) GetResources() v1beta3.Resources { + if m != nil { + return m.Resources + } + return v1beta3.Resources{} +} + +func (m *ResourceOffer) GetCount() uint32 { + if m != nil { + return m.Count + } + return 0 +} + +// MsgCreateBid defines an SDK message for creating Bid +type MsgCreateBid struct { + Order OrderID `protobuf:"bytes,1,opt,name=order,proto3" json:"order" yaml:"order"` + Provider string `protobuf:"bytes,2,opt,name=provider,proto3" json:"provider" yaml:"provider"` + Price types.DecCoin `protobuf:"bytes,3,opt,name=price,proto3" json:"price" yaml:"price"` + Deposit types.Coin `protobuf:"bytes,4,opt,name=deposit,proto3" json:"deposit" yaml:"deposit"` + ResourcesOffer ResourcesOffer `protobuf:"bytes,5,rep,name=resources_offer,json=resourcesOffer,proto3,castrepeated=ResourcesOffer" json:"resources_offer" yaml:"resources_offer"` +} + +func (m *MsgCreateBid) Reset() { *m = MsgCreateBid{} } +func (m *MsgCreateBid) String() string { return proto.CompactTextString(m) } +func (*MsgCreateBid) ProtoMessage() {} +func (*MsgCreateBid) Descriptor() ([]byte, []int) { + return fileDescriptor_c19fff42684bf143, []int{1} +} +func (m *MsgCreateBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateBid.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateBid.Merge(m, src) +} +func (m *MsgCreateBid) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateBid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateBid.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateBid proto.InternalMessageInfo + +func (m *MsgCreateBid) GetOrder() OrderID { + if m != nil { + return m.Order + } + return OrderID{} +} + +func (m *MsgCreateBid) GetProvider() string { + if m != nil { + return m.Provider + } + return "" +} + +func (m *MsgCreateBid) GetPrice() types.DecCoin { + if m != nil { + return m.Price + } + return types.DecCoin{} +} + +func (m *MsgCreateBid) GetDeposit() types.Coin { + if m != nil { + return m.Deposit + } + return types.Coin{} +} + +func (m *MsgCreateBid) GetResourcesOffer() ResourcesOffer { + if m != nil { + return m.ResourcesOffer + } + return nil +} + +// MsgCreateBidResponse defines the Msg/CreateBid response type. +type MsgCreateBidResponse struct { +} + +func (m *MsgCreateBidResponse) Reset() { *m = MsgCreateBidResponse{} } +func (m *MsgCreateBidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateBidResponse) ProtoMessage() {} +func (*MsgCreateBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c19fff42684bf143, []int{2} +} +func (m *MsgCreateBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateBidResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateBidResponse.Merge(m, src) +} +func (m *MsgCreateBidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateBidResponse proto.InternalMessageInfo + +// MsgCloseBid defines an SDK message for closing bid +type MsgCloseBid struct { + BidID BidID `protobuf:"bytes,1,opt,name=bid_id,json=bidId,proto3" json:"id" yaml:"id"` +} + +func (m *MsgCloseBid) Reset() { *m = MsgCloseBid{} } +func (m *MsgCloseBid) String() string { return proto.CompactTextString(m) } +func (*MsgCloseBid) ProtoMessage() {} +func (*MsgCloseBid) Descriptor() ([]byte, []int) { + return fileDescriptor_c19fff42684bf143, []int{3} +} +func (m *MsgCloseBid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCloseBid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCloseBid.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCloseBid) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCloseBid.Merge(m, src) +} +func (m *MsgCloseBid) XXX_Size() int { + return m.Size() +} +func (m *MsgCloseBid) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCloseBid.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCloseBid proto.InternalMessageInfo + +func (m *MsgCloseBid) GetBidID() BidID { + if m != nil { + return m.BidID + } + return BidID{} +} + +// MsgCloseBidResponse defines the Msg/CloseBid response type. +type MsgCloseBidResponse struct { +} + +func (m *MsgCloseBidResponse) Reset() { *m = MsgCloseBidResponse{} } +func (m *MsgCloseBidResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCloseBidResponse) ProtoMessage() {} +func (*MsgCloseBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c19fff42684bf143, []int{4} +} +func (m *MsgCloseBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCloseBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCloseBidResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCloseBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCloseBidResponse.Merge(m, src) +} +func (m *MsgCloseBidResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCloseBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCloseBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCloseBidResponse proto.InternalMessageInfo + +// BidID stores owner and all other seq numbers +// A successful bid becomes a Lease(ID). +type BidID struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner" yaml:"owner"` + DSeq uint64 `protobuf:"varint,2,opt,name=dseq,proto3" json:"dseq" yaml:"dseq"` + GSeq uint32 `protobuf:"varint,3,opt,name=gseq,proto3" json:"gseq" yaml:"gseq"` + OSeq uint32 `protobuf:"varint,4,opt,name=oseq,proto3" json:"oseq" yaml:"oseq"` + Provider string `protobuf:"bytes,5,opt,name=provider,proto3" json:"provider" yaml:"provider"` +} + +func (m *BidID) Reset() { *m = BidID{} } +func (*BidID) ProtoMessage() {} +func (*BidID) Descriptor() ([]byte, []int) { + return fileDescriptor_c19fff42684bf143, []int{5} +} +func (m *BidID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidID.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BidID) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidID.Merge(m, src) +} +func (m *BidID) XXX_Size() int { + return m.Size() +} +func (m *BidID) XXX_DiscardUnknown() { + xxx_messageInfo_BidID.DiscardUnknown(m) +} + +var xxx_messageInfo_BidID proto.InternalMessageInfo + +func (m *BidID) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *BidID) GetDSeq() uint64 { + if m != nil { + return m.DSeq + } + return 0 +} + +func (m *BidID) GetGSeq() uint32 { + if m != nil { + return m.GSeq + } + return 0 +} + +func (m *BidID) GetOSeq() uint32 { + if m != nil { + return m.OSeq + } + return 0 +} + +func (m *BidID) GetProvider() string { + if m != nil { + return m.Provider + } + return "" +} + +// Bid stores BidID, state of bid and price +type Bid struct { + BidID BidID `protobuf:"bytes,1,opt,name=bid_id,json=bidId,proto3" json:"id" yaml:"id"` + State Bid_State `protobuf:"varint,2,opt,name=state,proto3,enum=akash.market.v1beta4.Bid_State" json:"state" yaml:"state"` + Price types.DecCoin `protobuf:"bytes,3,opt,name=price,proto3" json:"price" yaml:"price"` + CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + ResourcesOffer ResourcesOffer `protobuf:"bytes,5,rep,name=resources_offer,json=resourcesOffer,proto3,castrepeated=ResourcesOffer" json:"resources_offer" yaml:"resources_offer"` +} + +func (m *Bid) Reset() { *m = Bid{} } +func (*Bid) ProtoMessage() {} +func (*Bid) Descriptor() ([]byte, []int) { + return fileDescriptor_c19fff42684bf143, []int{6} +} +func (m *Bid) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Bid) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Bid.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Bid) XXX_Merge(src proto.Message) { + xxx_messageInfo_Bid.Merge(m, src) +} +func (m *Bid) XXX_Size() int { + return m.Size() +} +func (m *Bid) XXX_DiscardUnknown() { + xxx_messageInfo_Bid.DiscardUnknown(m) +} + +var xxx_messageInfo_Bid proto.InternalMessageInfo + +func (m *Bid) GetBidID() BidID { + if m != nil { + return m.BidID + } + return BidID{} +} + +func (m *Bid) GetState() Bid_State { + if m != nil { + return m.State + } + return BidStateInvalid +} + +func (m *Bid) GetPrice() types.DecCoin { + if m != nil { + return m.Price + } + return types.DecCoin{} +} + +func (m *Bid) GetCreatedAt() int64 { + if m != nil { + return m.CreatedAt + } + return 0 +} + +func (m *Bid) GetResourcesOffer() ResourcesOffer { + if m != nil { + return m.ResourcesOffer + } + return nil +} + +// BidFilters defines flags for bid list filter +type BidFilters struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner" yaml:"owner"` + DSeq uint64 `protobuf:"varint,2,opt,name=dseq,proto3" json:"dseq" yaml:"dseq"` + GSeq uint32 `protobuf:"varint,3,opt,name=gseq,proto3" json:"gseq" yaml:"gseq"` + OSeq uint32 `protobuf:"varint,4,opt,name=oseq,proto3" json:"oseq" yaml:"oseq"` + Provider string `protobuf:"bytes,5,opt,name=provider,proto3" json:"provider" yaml:"provider"` + State string `protobuf:"bytes,6,opt,name=state,proto3" json:"state" yaml:"state"` +} + +func (m *BidFilters) Reset() { *m = BidFilters{} } +func (m *BidFilters) String() string { return proto.CompactTextString(m) } +func (*BidFilters) ProtoMessage() {} +func (*BidFilters) Descriptor() ([]byte, []int) { + return fileDescriptor_c19fff42684bf143, []int{7} +} +func (m *BidFilters) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BidFilters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BidFilters.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BidFilters) XXX_Merge(src proto.Message) { + xxx_messageInfo_BidFilters.Merge(m, src) +} +func (m *BidFilters) XXX_Size() int { + return m.Size() +} +func (m *BidFilters) XXX_DiscardUnknown() { + xxx_messageInfo_BidFilters.DiscardUnknown(m) +} + +var xxx_messageInfo_BidFilters proto.InternalMessageInfo + +func (m *BidFilters) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *BidFilters) GetDSeq() uint64 { + if m != nil { + return m.DSeq + } + return 0 +} + +func (m *BidFilters) GetGSeq() uint32 { + if m != nil { + return m.GSeq + } + return 0 +} + +func (m *BidFilters) GetOSeq() uint32 { + if m != nil { + return m.OSeq + } + return 0 +} + +func (m *BidFilters) GetProvider() string { + if m != nil { + return m.Provider + } + return "" +} + +func (m *BidFilters) GetState() string { + if m != nil { + return m.State + } + return "" +} + +func init() { + proto.RegisterEnum("akash.market.v1beta4.Bid_State", Bid_State_name, Bid_State_value) + proto.RegisterType((*ResourceOffer)(nil), "akash.market.v1beta4.ResourceOffer") + proto.RegisterType((*MsgCreateBid)(nil), "akash.market.v1beta4.MsgCreateBid") + proto.RegisterType((*MsgCreateBidResponse)(nil), "akash.market.v1beta4.MsgCreateBidResponse") + proto.RegisterType((*MsgCloseBid)(nil), "akash.market.v1beta4.MsgCloseBid") + proto.RegisterType((*MsgCloseBidResponse)(nil), "akash.market.v1beta4.MsgCloseBidResponse") + proto.RegisterType((*BidID)(nil), "akash.market.v1beta4.BidID") + proto.RegisterType((*Bid)(nil), "akash.market.v1beta4.Bid") + proto.RegisterType((*BidFilters)(nil), "akash.market.v1beta4.BidFilters") +} + +func init() { proto.RegisterFile("akash/market/v1beta4/bid.proto", fileDescriptor_c19fff42684bf143) } + +var fileDescriptor_c19fff42684bf143 = []byte{ + // 891 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x96, 0xcf, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xe3, 0xc4, 0x6e, 0x37, 0x93, 0x6d, 0x1b, 0x79, 0xbb, 0xab, 0x34, 0x50, 0x8f, 0x19, + 0x04, 0xea, 0x05, 0x5b, 0x6d, 0xb9, 0x50, 0x4e, 0xeb, 0xad, 0x40, 0x95, 0x40, 0x05, 0x17, 0x38, + 0xc0, 0xa1, 0x72, 0x3c, 0xb3, 0xde, 0x51, 0x53, 0x4f, 0xea, 0x71, 0xbb, 0xe2, 0x3f, 0x40, 0x3d, + 0x21, 0x71, 0xe1, 0x52, 0xb4, 0xd2, 0xde, 0xf6, 0x2f, 0xd9, 0x63, 0x8f, 0x9c, 0x06, 0x94, 0x0a, + 0x09, 0xe5, 0x98, 0x7f, 0x00, 0x34, 0x3f, 0xe2, 0xfc, 0x50, 0x41, 0xe2, 0xd0, 0x03, 0xd2, 0x9e, + 0xdc, 0xf9, 0xbe, 0xf9, 0xbc, 0x79, 0x7e, 0xf3, 0x7d, 0x8d, 0x81, 0x97, 0x9c, 0x24, 0xfc, 0x59, + 0x78, 0x9a, 0x14, 0x27, 0xa4, 0x0c, 0x2f, 0xb6, 0x7b, 0xa4, 0x4c, 0x3e, 0x0c, 0x7b, 0x14, 0x07, + 0x83, 0x82, 0x95, 0xcc, 0x5d, 0x57, 0xf1, 0x40, 0xc7, 0x03, 0x13, 0xef, 0xae, 0x67, 0x2c, 0x63, + 0x6a, 0x43, 0x28, 0xff, 0xd2, 0x7b, 0xbb, 0x5e, 0xca, 0xf8, 0x29, 0xe3, 0x61, 0x2f, 0xe1, 0xc4, + 0xa4, 0xda, 0x0e, 0x53, 0x46, 0x73, 0x13, 0x47, 0xfa, 0xac, 0x99, 0xf0, 0x6e, 0x58, 0x10, 0xce, + 0xce, 0x8b, 0x94, 0x70, 0xb3, 0xc7, 0xbf, 0xb5, 0x1e, 0x56, 0x60, 0x52, 0xe8, 0x1d, 0xe8, 0x95, + 0x05, 0x56, 0x62, 0x43, 0x1d, 0x3e, 0x7d, 0x4a, 0x0a, 0xb7, 0x07, 0x9a, 0x55, 0x9a, 0x8e, 0xe5, + 0x5b, 0x5b, 0xad, 0x9d, 0xcd, 0x40, 0xd7, 0x2d, 0xcf, 0x32, 0x55, 0xef, 0x06, 0x13, 0x8a, 0x47, + 0xef, 0xbd, 0x16, 0xb0, 0x36, 0x12, 0x70, 0xca, 0x8d, 0x05, 0x6c, 0x7f, 0x9f, 0x9c, 0xf6, 0xf7, + 0x50, 0x25, 0xa1, 0x78, 0x1a, 0x76, 0x43, 0xe0, 0xa4, 0xec, 0x3c, 0x2f, 0x3b, 0x75, 0xdf, 0xda, + 0x5a, 0x89, 0x36, 0x46, 0x02, 0x6a, 0x61, 0x2c, 0xe0, 0x7d, 0x0d, 0xaa, 0x25, 0x8a, 0xb5, 0xbc, + 0x67, 0xff, 0xf9, 0x02, 0x5a, 0xe8, 0xaf, 0x06, 0xb8, 0xff, 0x39, 0xcf, 0x9e, 0x14, 0x24, 0x29, + 0x49, 0x44, 0xb1, 0xfb, 0x1d, 0x70, 0xd4, 0xcb, 0x2c, 0xd4, 0x39, 0xdf, 0xdf, 0xe0, 0x50, 0x6e, + 0x39, 0xd8, 0x8f, 0xde, 0x97, 0x75, 0x0e, 0x05, 0x74, 0x94, 0x20, 0xcf, 0x54, 0xf0, 0xf4, 0x4c, + 0xb5, 0x44, 0xb1, 0x96, 0xdd, 0x8f, 0xc1, 0xbd, 0x41, 0xc1, 0x2e, 0xa8, 0xcc, 0x2f, 0xeb, 0x6c, + 0x46, 0x70, 0x24, 0x60, 0xa5, 0x8d, 0x05, 0x5c, 0xd3, 0xd8, 0x44, 0x41, 0x71, 0x15, 0x74, 0xbf, + 0x04, 0xce, 0xa0, 0xa0, 0x29, 0xe9, 0x34, 0x54, 0x65, 0x6f, 0x07, 0xfa, 0x36, 0x67, 0x5b, 0xb8, + 0x1d, 0xec, 0x93, 0xf4, 0x09, 0xa3, 0x79, 0xb4, 0x69, 0x1a, 0xa8, 0x91, 0x69, 0x3d, 0x6a, 0x89, + 0x62, 0x2d, 0xbb, 0xdf, 0x80, 0x65, 0x4c, 0x06, 0x8c, 0xd3, 0xb2, 0x63, 0xab, 0xa4, 0x1b, 0xb7, + 0x26, 0x55, 0x19, 0xdf, 0x31, 0x19, 0x27, 0xc4, 0x58, 0xc0, 0x55, 0x9d, 0xd3, 0x08, 0x28, 0x9e, + 0x84, 0xdc, 0x97, 0x16, 0x58, 0xab, 0xae, 0xe6, 0x98, 0x49, 0x13, 0x74, 0x1c, 0xbf, 0xb1, 0xd5, + 0xda, 0x79, 0xf7, 0xf6, 0x7e, 0xce, 0xf9, 0x25, 0xfa, 0xda, 0x74, 0x75, 0xb5, 0x32, 0x84, 0xd2, + 0x47, 0x02, 0x2e, 0x66, 0x1d, 0x0b, 0xf8, 0x68, 0xc1, 0x15, 0x3a, 0x80, 0x5e, 0xfd, 0xb6, 0x88, + 0xc7, 0xab, 0xc5, 0xdc, 0x5a, 0x39, 0xa0, 0x86, 0x1e, 0x81, 0xf5, 0x59, 0x03, 0xc4, 0x84, 0x0f, + 0x58, 0xce, 0x09, 0xa2, 0xa0, 0x25, 0xf5, 0x3e, 0xe3, 0xca, 0x17, 0x5f, 0x81, 0xa5, 0x1e, 0xc5, + 0xc7, 0x14, 0x1b, 0x63, 0xbc, 0x75, 0xfb, 0x8b, 0x44, 0x14, 0x1f, 0xec, 0x47, 0xfe, 0xc4, 0x16, + 0x6a, 0x39, 0x12, 0xb0, 0x4e, 0xf1, 0x58, 0xc0, 0xa6, 0x2e, 0x95, 0x62, 0x14, 0x3b, 0x3d, 0x8a, + 0x0f, 0xb0, 0x29, 0xe1, 0x21, 0x78, 0x30, 0x73, 0x54, 0x55, 0xc1, 0x2f, 0x75, 0xa0, 0x13, 0x48, + 0x73, 0xb3, 0xe7, 0xb9, 0x31, 0x65, 0x53, 0x9b, 0x5b, 0x09, 0x33, 0x46, 0x93, 0x4b, 0x69, 0x34, + 0xf9, 0x74, 0x77, 0x81, 0x8d, 0x39, 0x39, 0x53, 0x26, 0xb3, 0x23, 0x38, 0x14, 0xd0, 0xde, 0x3f, + 0x22, 0x67, 0x23, 0x01, 0x95, 0x3e, 0x16, 0xb0, 0x65, 0xee, 0x8e, 0x93, 0x33, 0x14, 0x2b, 0x51, + 0x42, 0x99, 0x84, 0x1a, 0x6a, 0x82, 0x14, 0xf4, 0xa9, 0x81, 0xb2, 0x39, 0x28, 0xd3, 0x50, 0x66, + 0x20, 0x26, 0x21, 0x7b, 0x0a, 0x1d, 0x1a, 0x88, 0xcd, 0x41, 0x4c, 0x43, 0xf2, 0x31, 0x37, 0x07, + 0xce, 0x7f, 0x9c, 0x83, 0xbd, 0x7b, 0x3f, 0xbf, 0x80, 0x35, 0xd5, 0xb7, 0x3f, 0x6c, 0xd0, 0xb8, + 0xb3, 0xbb, 0x71, 0xbf, 0x00, 0x0e, 0x2f, 0x93, 0x92, 0xa8, 0x26, 0xae, 0xee, 0xc0, 0x7f, 0x4c, + 0x1a, 0x1c, 0xc9, 0x6d, 0xfa, 0x56, 0x14, 0x31, 0xbd, 0x15, 0xb5, 0x44, 0xb1, 0x96, 0xef, 0x62, + 0x82, 0x37, 0x01, 0x48, 0x95, 0x75, 0xf1, 0x71, 0xa2, 0x87, 0xb8, 0x11, 0x37, 0x8d, 0xf2, 0xf8, + 0x7f, 0x32, 0x88, 0xe8, 0x27, 0x0b, 0x38, 0xaa, 0x87, 0xae, 0x0f, 0x96, 0x69, 0x7e, 0x91, 0xf4, + 0x29, 0x6e, 0xd7, 0xba, 0x0f, 0x2e, 0xaf, 0xfc, 0xb5, 0x88, 0x62, 0x15, 0x3a, 0xd0, 0xb2, 0xfb, + 0x10, 0xd8, 0x6c, 0x40, 0xf2, 0xb6, 0xd5, 0x6d, 0x5d, 0x5e, 0xf9, 0xcb, 0x11, 0xc5, 0x87, 0x03, + 0x92, 0xbb, 0x1b, 0x60, 0x29, 0x49, 0x4b, 0x7a, 0x41, 0xda, 0xf5, 0xee, 0xca, 0xe5, 0x95, 0xdf, + 0x8c, 0x28, 0x7e, 0xac, 0x04, 0x49, 0xf4, 0x19, 0x2f, 0xdb, 0x8d, 0x8a, 0xf8, 0x8c, 0xf1, 0x52, + 0x12, 0xa9, 0x9c, 0x38, 0xdc, 0xb6, 0x2b, 0x42, 0x8d, 0x20, 0xee, 0xda, 0x3f, 0xbc, 0xf4, 0x6a, + 0x33, 0x3e, 0xbb, 0xae, 0x03, 0x10, 0x51, 0xfc, 0x09, 0xed, 0x97, 0xa4, 0xe0, 0x6f, 0xa6, 0x71, + 0xf6, 0x57, 0x29, 0x9c, 0x4c, 0xc9, 0xd2, 0xb4, 0x19, 0xff, 0x36, 0x04, 0xfa, 0x5f, 0x5e, 0x74, + 0xf4, 0x7a, 0xe8, 0x59, 0xd7, 0x43, 0xcf, 0xfa, 0x7d, 0xe8, 0x59, 0x3f, 0xde, 0x78, 0xb5, 0xeb, + 0x1b, 0xaf, 0xf6, 0xeb, 0x8d, 0x57, 0xfb, 0xf6, 0xa3, 0x8c, 0x96, 0xcf, 0xce, 0x7b, 0x41, 0xca, + 0x4e, 0x43, 0x65, 0xd1, 0x0f, 0x72, 0x52, 0x3e, 0x67, 0xc5, 0x89, 0x59, 0x25, 0x03, 0x1a, 0x66, + 0x2c, 0xcc, 0x19, 0x26, 0x0b, 0x5f, 0x21, 0xbd, 0x25, 0xf5, 0x01, 0xb2, 0xfb, 0x77, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x32, 0x11, 0x67, 0xc4, 0x34, 0x09, 0x00, 0x00, +} + +func (this *ResourceOffer) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ResourceOffer) + if !ok { + that2, ok := that.(ResourceOffer) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Resources.Equal(&that1.Resources) { + return false + } + if this.Count != that1.Count { + return false + } + return true +} +func (m *ResourceOffer) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ResourceOffer) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResourceOffer) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Count != 0 { + i = encodeVarintBid(dAtA, i, uint64(m.Count)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.Resources.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgCreateBid) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ResourcesOffer) > 0 { + for iNdEx := len(m.ResourcesOffer) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourcesOffer[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + { + size, err := m.Deposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + { + size, err := m.Price.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintBid(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Order.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgCreateBidResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCloseBid) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCloseBid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCloseBid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BidID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgCloseBidResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCloseBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCloseBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *BidID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BidID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintBid(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x2a + } + if m.OSeq != 0 { + i = encodeVarintBid(dAtA, i, uint64(m.OSeq)) + i-- + dAtA[i] = 0x20 + } + if m.GSeq != 0 { + i = encodeVarintBid(dAtA, i, uint64(m.GSeq)) + i-- + dAtA[i] = 0x18 + } + if m.DSeq != 0 { + i = encodeVarintBid(dAtA, i, uint64(m.DSeq)) + i-- + dAtA[i] = 0x10 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintBid(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Bid) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Bid) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Bid) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ResourcesOffer) > 0 { + for iNdEx := len(m.ResourcesOffer) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ResourcesOffer[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if m.CreatedAt != 0 { + i = encodeVarintBid(dAtA, i, uint64(m.CreatedAt)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.Price.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.State != 0 { + i = encodeVarintBid(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.BidID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBid(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *BidFilters) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BidFilters) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BidFilters) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintBid(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0x32 + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintBid(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x2a + } + if m.OSeq != 0 { + i = encodeVarintBid(dAtA, i, uint64(m.OSeq)) + i-- + dAtA[i] = 0x20 + } + if m.GSeq != 0 { + i = encodeVarintBid(dAtA, i, uint64(m.GSeq)) + i-- + dAtA[i] = 0x18 + } + if m.DSeq != 0 { + i = encodeVarintBid(dAtA, i, uint64(m.DSeq)) + i-- + dAtA[i] = 0x10 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintBid(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintBid(dAtA []byte, offset int, v uint64) int { + offset -= sovBid(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ResourceOffer) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Resources.Size() + n += 1 + l + sovBid(uint64(l)) + if m.Count != 0 { + n += 1 + sovBid(uint64(m.Count)) + } + return n +} + +func (m *MsgCreateBid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Order.Size() + n += 1 + l + sovBid(uint64(l)) + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovBid(uint64(l)) + } + l = m.Price.Size() + n += 1 + l + sovBid(uint64(l)) + l = m.Deposit.Size() + n += 1 + l + sovBid(uint64(l)) + if len(m.ResourcesOffer) > 0 { + for _, e := range m.ResourcesOffer { + l = e.Size() + n += 1 + l + sovBid(uint64(l)) + } + } + return n +} + +func (m *MsgCreateBidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCloseBid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.BidID.Size() + n += 1 + l + sovBid(uint64(l)) + return n +} + +func (m *MsgCloseBidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *BidID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovBid(uint64(l)) + } + if m.DSeq != 0 { + n += 1 + sovBid(uint64(m.DSeq)) + } + if m.GSeq != 0 { + n += 1 + sovBid(uint64(m.GSeq)) + } + if m.OSeq != 0 { + n += 1 + sovBid(uint64(m.OSeq)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovBid(uint64(l)) + } + return n +} + +func (m *Bid) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.BidID.Size() + n += 1 + l + sovBid(uint64(l)) + if m.State != 0 { + n += 1 + sovBid(uint64(m.State)) + } + l = m.Price.Size() + n += 1 + l + sovBid(uint64(l)) + if m.CreatedAt != 0 { + n += 1 + sovBid(uint64(m.CreatedAt)) + } + if len(m.ResourcesOffer) > 0 { + for _, e := range m.ResourcesOffer { + l = e.Size() + n += 1 + l + sovBid(uint64(l)) + } + } + return n +} + +func (m *BidFilters) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovBid(uint64(l)) + } + if m.DSeq != 0 { + n += 1 + sovBid(uint64(m.DSeq)) + } + if m.GSeq != 0 { + n += 1 + sovBid(uint64(m.GSeq)) + } + if m.OSeq != 0 { + n += 1 + sovBid(uint64(m.OSeq)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovBid(uint64(l)) + } + l = len(m.State) + if l > 0 { + n += 1 + l + sovBid(uint64(l)) + } + return n +} + +func sovBid(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozBid(x uint64) (n int) { + return sovBid(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ResourceOffer) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ResourceOffer: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ResourceOffer: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Resources", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Resources.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Count", wireType) + } + m.Count = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Count |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipBid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateBid) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Order", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Order.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Deposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourcesOffer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourcesOffer = append(m.ResourcesOffer, ResourceOffer{}) + if err := m.ResourcesOffer[len(m.ResourcesOffer)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateBidResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipBid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCloseBid) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCloseBid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCloseBid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BidID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCloseBidResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCloseBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCloseBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipBid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BidID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BidID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DSeq", wireType) + } + m.DSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DSeq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GSeq", wireType) + } + m.GSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OSeq", wireType) + } + m.OSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Bid) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Bid: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Bid: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BidID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= Bid_State(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + m.CreatedAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedAt |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ResourcesOffer", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ResourcesOffer = append(m.ResourcesOffer, ResourceOffer{}) + if err := m.ResourcesOffer[len(m.ResourcesOffer)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *BidFilters) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BidFilters: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BidFilters: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DSeq", wireType) + } + m.DSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DSeq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GSeq", wireType) + } + m.GSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OSeq", wireType) + } + m.OSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBid + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthBid + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthBid + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.State = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipBid(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthBid + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipBid(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBid + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBid + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowBid + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthBid + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupBid + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthBid + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthBid = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowBid = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupBid = fmt.Errorf("proto: unexpected end of group") +) diff --git a/go/node/market/v1beta4/codec.go b/go/node/market/v1beta4/codec.go new file mode 100644 index 00000000..b7ccd985 --- /dev/null +++ b/go/node/market/v1beta4/codec.go @@ -0,0 +1,50 @@ +package v1beta4 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" +) + +var ( + amino = codec.NewLegacyAmino() + + // ModuleCdc references the global x/market module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/market and + // defined at the application level. + ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) +) + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} + +// RegisterCodec registers the necessary x/market interfaces and concrete types +// on the provided Amino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgCreateBid{}, ModuleName+"/"+MsgTypeCreateBid, nil) + cdc.RegisterConcrete(&MsgCloseBid{}, ModuleName+"/"+MsgTypeCloseBid, nil) + cdc.RegisterConcrete(&MsgCreateLease{}, ModuleName+"/"+MsgTypeCreateLease, nil) + cdc.RegisterConcrete(&MsgWithdrawLease{}, ModuleName+"/"+MsgTypeWithdrawLease, nil) + cdc.RegisterConcrete(&MsgCloseLease{}, ModuleName+"/"+MsgTypeCloseLease, nil) +} + +// RegisterInterfaces registers the x/market interfaces types with the interface registry +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateBid{}, + &MsgCloseBid{}, + &MsgCreateLease{}, + &MsgWithdrawLease{}, + &MsgCloseLease{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} diff --git a/go/node/market/v1beta4/errors.go b/go/node/market/v1beta4/errors.go new file mode 100644 index 00000000..21cd9950 --- /dev/null +++ b/go/node/market/v1beta4/errors.go @@ -0,0 +1,107 @@ +package v1beta4 + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const ( + errCodeEmptyProvider uint32 = iota + 1 + errCodeSameAccount + errCodeInternal + errCodeOverOrder + errCodeAttributeMismatch + errCodeUnknownBid + errCodeUnknownLease + errCodeUnknownLeaseForOrder + errCodeUnknownOrderForBid + errCodeLeaseNotActive + errCodeBidNotActive + errCodeBidNotOpen + errCodeOrderNotOpen + errCodeNoLeaseForOrder + errCodeOrderNotFound + errCodeGroupNotFound + errCodeGroupNotOpen + errCodeBidNotFound + errCodeBidZeroPrice + errCodeLeaseNotFound + errCodeBidExists + errCodeInvalidPrice + errCodeOrderActive + errCodeOrderClosed + errCodeOrderExists + errCodeOrderDurationExceeded + errCodeOrderTooEarly + errInvalidDeposit + errInvalidParam + errUnknownProvider + errInvalidBid + errCodeCapabilitiesMismatch +) + +var ( + // ErrEmptyProvider is the error when provider is empty + ErrEmptyProvider = sdkerrors.Register(ModuleName, errCodeEmptyProvider, "empty provider") + // ErrSameAccount is the error when owner and provider are the same account + ErrSameAccount = sdkerrors.Register(ModuleName, errCodeSameAccount, "owner and provider are the same account") + // ErrInternal is the error for internal error + ErrInternal = sdkerrors.Register(ModuleName, errCodeInternal, "internal error") + // ErrBidOverOrder is the error when bid price is above max order price + ErrBidOverOrder = sdkerrors.Register(ModuleName, errCodeOverOrder, "bid price above max order price") + // ErrAttributeMismatch is the error for attribute mismatch + ErrAttributeMismatch = sdkerrors.Register(ModuleName, errCodeAttributeMismatch, "attribute mismatch") + // ErrCapabilitiesMismatch is the error for capabilities mismatch + ErrCapabilitiesMismatch = sdkerrors.Register(ModuleName, errCodeCapabilitiesMismatch, "capabilities mismatch") + // ErrUnknownBid is the error for unknown bid + ErrUnknownBid = sdkerrors.Register(ModuleName, errCodeUnknownBid, "unknown bid") + // ErrUnknownLease is the error for unknown bid + ErrUnknownLease = sdkerrors.Register(ModuleName, errCodeUnknownLease, "unknown lease") + // ErrUnknownLeaseForBid is the error when lease is unknown for bid + ErrUnknownLeaseForBid = sdkerrors.Register(ModuleName, errCodeUnknownLeaseForOrder, "unknown lease for bid") + // ErrUnknownOrderForBid is the error when order is unknown for bid + ErrUnknownOrderForBid = sdkerrors.Register(ModuleName, errCodeUnknownOrderForBid, "unknown order for bid") + // ErrLeaseNotActive is the error when lease is not active + ErrLeaseNotActive = sdkerrors.Register(ModuleName, errCodeLeaseNotActive, "lease not active") + // ErrBidNotActive is the error when bid is not matched + ErrBidNotActive = sdkerrors.Register(ModuleName, errCodeBidNotActive, "bid not active") + // ErrBidNotOpen is the error when bid is not matched + ErrBidNotOpen = sdkerrors.Register(ModuleName, errCodeBidNotOpen, "bid not open") + // ErrNoLeaseForOrder is the error when there is no lease for order + ErrNoLeaseForOrder = sdkerrors.Register(ModuleName, errCodeNoLeaseForOrder, "no lease for order") + // ErrOrderNotFound order not found + ErrOrderNotFound = sdkerrors.Register(ModuleName, errCodeOrderNotFound, "invalid order: order not found") + // ErrGroupNotFound order not found + ErrGroupNotFound = sdkerrors.Register(ModuleName, errCodeGroupNotFound, "order not found") + // ErrGroupNotOpen order not found + ErrGroupNotOpen = sdkerrors.Register(ModuleName, errCodeGroupNotOpen, "order not open") + // ErrOrderNotOpen order not found + ErrOrderNotOpen = sdkerrors.Register(ModuleName, errCodeOrderNotOpen, "bid: order not open") + // ErrBidNotFound bid not found + ErrBidNotFound = sdkerrors.Register(ModuleName, errCodeBidNotFound, "invalid bid: bid not found") + // ErrBidZeroPrice zero price + ErrBidZeroPrice = sdkerrors.Register(ModuleName, errCodeBidZeroPrice, "invalid bid: zero price") + // ErrLeaseNotFound lease not found + ErrLeaseNotFound = sdkerrors.Register(ModuleName, errCodeLeaseNotFound, "invalid lease: lease not found") + // ErrBidExists bid exists + ErrBidExists = sdkerrors.Register(ModuleName, errCodeBidExists, "invalid bid: bid exists from provider") + // ErrBidInvalidPrice bid invalid price + ErrBidInvalidPrice = sdkerrors.Register(ModuleName, errCodeInvalidPrice, "bid price is invalid") + // ErrOrderActive order active + ErrOrderActive = sdkerrors.New(ModuleName, errCodeOrderActive, "order active") + // ErrOrderClosed order closed + ErrOrderClosed = sdkerrors.New(ModuleName, errCodeOrderClosed, "order closed") + // ErrOrderExists indicates a new order was proposed overwrite the existing store key + ErrOrderExists = sdkerrors.New(ModuleName, errCodeOrderExists, "order already exists in store") + // ErrOrderTooEarly to match bid + ErrOrderTooEarly = sdkerrors.New(ModuleName, errCodeOrderTooEarly, "order: chain height to low for bidding") + // ErrOrderDurationExceeded order should be closed + ErrOrderDurationExceeded = sdkerrors.New(ModuleName, errCodeOrderDurationExceeded, "order duration has exceeded the bidding duration") + // ErrInvalidDeposit indicates an invalid deposit + ErrInvalidDeposit = sdkerrors.Register(ModuleName, errInvalidDeposit, "Deposit invalid") + // ErrInvalidParam indicates an invalid chain parameter + ErrInvalidParam = sdkerrors.Register(ModuleName, errInvalidParam, "parameter invalid") + // ErrUnknownProvider indicates an invalid chain parameter + ErrUnknownProvider = sdkerrors.Register(ModuleName, errUnknownProvider, "unknown provider") + // ErrInvalidBid indicates an invalid chain parameter + ErrInvalidBid = sdkerrors.Register(ModuleName, errInvalidBid, "unknown provider") +) diff --git a/go/node/market/v1beta4/escrow.go b/go/node/market/v1beta4/escrow.go new file mode 100644 index 00000000..eebb2edf --- /dev/null +++ b/go/node/market/v1beta4/escrow.go @@ -0,0 +1,61 @@ +package v1beta4 + +import ( + "fmt" + "strconv" + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + + etypes "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + + dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" +) + +const ( + bidEscrowScope = "bid" +) + +func EscrowAccountForBid(id BidID) etypes.AccountID { + return etypes.AccountID{ + Scope: bidEscrowScope, + XID: id.String(), + } +} + +func EscrowPaymentForLease(id LeaseID) string { + return fmt.Sprintf("%v/%v/%s", id.GSeq, id.OSeq, id.Provider) +} + +func LeaseIDFromEscrowAccount(id etypes.AccountID, pid string) (LeaseID, bool) { + did, ok := dtypes.DeploymentIDFromEscrowAccount(id) + if !ok { + return LeaseID{}, false + } + + parts := strings.Split(pid, "/") + if len(parts) != 3 { + return LeaseID{}, false + } + + gseq, err := strconv.ParseUint(parts[0], 10, 32) + if err != nil { + return LeaseID{}, false + } + + oseq, err := strconv.ParseUint(parts[1], 10, 32) + if err != nil { + return LeaseID{}, false + } + + owner, err := sdk.AccAddressFromBech32(parts[2]) + if err != nil { + return LeaseID{}, false + } + + return MakeLeaseID( + MakeBidID( + MakeOrderID( + dtypes.MakeGroupID( + did, uint32(gseq)), uint32(oseq)), owner)), true +} diff --git a/go/node/market/v1beta4/event.go b/go/node/market/v1beta4/event.go new file mode 100644 index 00000000..a5ddc150 --- /dev/null +++ b/go/node/market/v1beta4/event.go @@ -0,0 +1,359 @@ +package v1beta4 + +import ( + "errors" + "strconv" + + sdk "github.com/cosmos/cosmos-sdk/types" + + dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + "github.com/akash-network/akash-api/go/sdkutil" +) + +const ( + evActionOrderCreated = "order-created" + evActionOrderClosed = "order-closed" + evActionBidCreated = "bid-created" + evActionBidClosed = "bid-closed" + evActionLeaseCreated = "lease-created" + evActionLeaseClosed = "lease-closed" + + evOSeqKey = "oseq" + evProviderKey = "provider" + evPriceDenomKey = "price-denom" + evPriceAmountKey = "price-amount" +) + +var ( + ErrParsingPrice = errors.New("error parsing price") +) + +// EventOrderCreated struct +type EventOrderCreated struct { + Context sdkutil.BaseModuleEvent `json:"context"` + ID OrderID `json:"id"` +} + +func NewEventOrderCreated(id OrderID) EventOrderCreated { + return EventOrderCreated{ + Context: sdkutil.BaseModuleEvent{ + Module: ModuleName, + Action: evActionOrderCreated, + }, + ID: id, + } +} + +// ToSDKEvent method creates new sdk event for EventOrderCreated struct +func (e EventOrderCreated) ToSDKEvent() sdk.Event { + return sdk.NewEvent(sdkutil.EventTypeMessage, + append([]sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), + sdk.NewAttribute(sdk.AttributeKeyAction, evActionOrderCreated), + }, orderIDEVAttributes(e.ID)...)..., + ) +} + +// EventOrderClosed struct +type EventOrderClosed struct { + Context sdkutil.BaseModuleEvent `json:"context"` + ID OrderID `json:"id"` +} + +func NewEventOrderClosed(id OrderID) EventOrderClosed { + return EventOrderClosed{ + Context: sdkutil.BaseModuleEvent{ + Module: ModuleName, + Action: evActionOrderClosed, + }, + ID: id, + } +} + +// ToSDKEvent method creates new sdk event for EventOrderClosed struct +func (e EventOrderClosed) ToSDKEvent() sdk.Event { + return sdk.NewEvent(sdkutil.EventTypeMessage, + append([]sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), + sdk.NewAttribute(sdk.AttributeKeyAction, evActionOrderClosed), + }, orderIDEVAttributes(e.ID)...)..., + ) +} + +// EventBidCreated struct +type EventBidCreated struct { + Context sdkutil.BaseModuleEvent `json:"context"` + ID BidID `json:"id"` + Price sdk.DecCoin `json:"price"` +} + +func NewEventBidCreated(id BidID, price sdk.DecCoin) EventBidCreated { + return EventBidCreated{ + Context: sdkutil.BaseModuleEvent{ + Module: ModuleName, + Action: evActionBidCreated, + }, + ID: id, + Price: price, + } +} + +// ToSDKEvent method creates new sdk event for EventBidCreated struct +func (e EventBidCreated) ToSDKEvent() sdk.Event { + return sdk.NewEvent(sdkutil.EventTypeMessage, + append( + append([]sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), + sdk.NewAttribute(sdk.AttributeKeyAction, evActionBidCreated), + }, bidIDEVAttributes(e.ID)...), + priceEVAttributes(e.Price)...)..., + ) +} + +// EventBidClosed struct +type EventBidClosed struct { + Context sdkutil.BaseModuleEvent `json:"context"` + ID BidID `json:"id"` + Price sdk.DecCoin `json:"price"` +} + +func NewEventBidClosed(id BidID, price sdk.DecCoin) EventBidClosed { + return EventBidClosed{ + Context: sdkutil.BaseModuleEvent{ + Module: ModuleName, + Action: evActionBidClosed, + }, + ID: id, + Price: price, + } +} + +// ToSDKEvent method creates new sdk event for EventBidClosed struct +func (e EventBidClosed) ToSDKEvent() sdk.Event { + return sdk.NewEvent(sdkutil.EventTypeMessage, + append( + append([]sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), + sdk.NewAttribute(sdk.AttributeKeyAction, evActionBidClosed), + }, bidIDEVAttributes(e.ID)...), + priceEVAttributes(e.Price)...)..., + ) +} + +// EventLeaseCreated struct +type EventLeaseCreated struct { + Context sdkutil.BaseModuleEvent `json:"context"` + ID LeaseID `json:"id"` + Price sdk.DecCoin `json:"price"` +} + +func NewEventLeaseCreated(id LeaseID, price sdk.DecCoin) EventLeaseCreated { + return EventLeaseCreated{ + Context: sdkutil.BaseModuleEvent{ + Module: ModuleName, + Action: evActionLeaseCreated, + }, + ID: id, + Price: price, + } +} + +// ToSDKEvent method creates new sdk event for EventLeaseCreated struct +func (e EventLeaseCreated) ToSDKEvent() sdk.Event { + return sdk.NewEvent(sdkutil.EventTypeMessage, + append( + append([]sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), + sdk.NewAttribute(sdk.AttributeKeyAction, evActionLeaseCreated), + }, leaseIDEVAttributes(e.ID)...), + priceEVAttributes(e.Price)...)...) +} + +// EventLeaseClosed struct +type EventLeaseClosed struct { + Context sdkutil.BaseModuleEvent `json:"context"` + ID LeaseID `json:"id"` + Price sdk.DecCoin `json:"price"` +} + +func NewEventLeaseClosed(id LeaseID, price sdk.DecCoin) EventLeaseClosed { + return EventLeaseClosed{ + Context: sdkutil.BaseModuleEvent{ + Module: ModuleName, + Action: evActionLeaseClosed, + }, + ID: id, + Price: price, + } +} + +// ToSDKEvent method creates new sdk event for EventLeaseClosed struct +func (e EventLeaseClosed) ToSDKEvent() sdk.Event { + return sdk.NewEvent(sdkutil.EventTypeMessage, + append( + append([]sdk.Attribute{ + sdk.NewAttribute(sdk.AttributeKeyModule, ModuleName), + sdk.NewAttribute(sdk.AttributeKeyAction, evActionLeaseClosed), + }, leaseIDEVAttributes(e.ID)...), + priceEVAttributes(e.Price)...)...) +} + +// orderIDEVAttributes returns event attribues for given orderID +func orderIDEVAttributes(id OrderID) []sdk.Attribute { + return append(dtypes.GroupIDEVAttributes(id.GroupID()), + sdk.NewAttribute(evOSeqKey, strconv.FormatUint(uint64(id.OSeq), 10))) +} + +// parseEVOrderID returns orderID for given event attributes +func parseEVOrderID(attrs []sdk.Attribute) (OrderID, error) { + gid, err := dtypes.ParseEVGroupID(attrs) + if err != nil { + return OrderID{}, err + } + oseq, err := sdkutil.GetUint64(attrs, evOSeqKey) + if err != nil { + return OrderID{}, err + } + + return OrderID{ + Owner: gid.Owner, + DSeq: gid.DSeq, + GSeq: gid.GSeq, + OSeq: uint32(oseq), + }, nil + +} + +// bidIDEVAttributes returns event attribues for given bidID +func bidIDEVAttributes(id BidID) []sdk.Attribute { + return append(orderIDEVAttributes(id.OrderID()), + sdk.NewAttribute(evProviderKey, id.Provider)) +} + +// parseEVBidID returns bidID for given event attributes +func parseEVBidID(attrs []sdk.Attribute) (BidID, error) { + oid, err := parseEVOrderID(attrs) + if err != nil { + return BidID{}, err + } + + provider, err := sdkutil.GetAccAddress(attrs, evProviderKey) + if err != nil { + return BidID{}, err + } + + return BidID{ + Owner: oid.Owner, + DSeq: oid.DSeq, + GSeq: oid.GSeq, + OSeq: oid.OSeq, + Provider: provider.String(), + }, nil +} + +// leaseIDEVAttributes returns event attribues for given LeaseID +func leaseIDEVAttributes(id LeaseID) []sdk.Attribute { + return append(orderIDEVAttributes(id.OrderID()), + sdk.NewAttribute(evProviderKey, id.Provider)) +} + +// parseEVLeaseID returns leaseID for given event attributes +func parseEVLeaseID(attrs []sdk.Attribute) (LeaseID, error) { + bid, err := parseEVBidID(attrs) + if err != nil { + return LeaseID{}, err + } + return LeaseID(bid), nil +} + +func priceEVAttributes(price sdk.DecCoin) []sdk.Attribute { + return []sdk.Attribute{ + sdk.NewAttribute(evPriceDenomKey, price.Denom), + sdk.NewAttribute(evPriceAmountKey, price.Amount.String()), + } +} + +func parseEVPriceAttributes(attrs []sdk.Attribute) (sdk.DecCoin, error) { + denom, err := sdkutil.GetString(attrs, evPriceDenomKey) + if err != nil { + return sdk.DecCoin{}, err + } + + amounts, err := sdkutil.GetString(attrs, evPriceAmountKey) + if err != nil { + return sdk.DecCoin{}, err + } + + amount, err := sdk.NewDecFromStr(amounts) + if err != nil { + return sdk.DecCoin{}, ErrParsingPrice + } + + return sdk.NewDecCoinFromDec(denom, amount), nil +} + +// ParseEvent parses event and returns details of event and error if occurred +func ParseEvent(ev sdkutil.Event) (sdkutil.ModuleEvent, error) { + if ev.Type != sdkutil.EventTypeMessage { + return nil, sdkutil.ErrUnknownType + } + if ev.Module != ModuleName { + return nil, sdkutil.ErrUnknownModule + } + switch ev.Action { + + case evActionOrderCreated: + id, err := parseEVOrderID(ev.Attributes) + if err != nil { + return nil, err + } + return NewEventOrderCreated(id), nil + case evActionOrderClosed: + id, err := parseEVOrderID(ev.Attributes) + if err != nil { + return nil, err + } + return NewEventOrderClosed(id), nil + + case evActionBidCreated: + id, err := parseEVBidID(ev.Attributes) + if err != nil { + return nil, err + } + price, err := parseEVPriceAttributes(ev.Attributes) + if err != nil { + return nil, err + } + return NewEventBidCreated(id, price), nil + case evActionBidClosed: + id, err := parseEVBidID(ev.Attributes) + if err != nil { + return nil, err + } + // optional price + price, _ := parseEVPriceAttributes(ev.Attributes) + return NewEventBidClosed(id, price), nil + + case evActionLeaseCreated: + id, err := parseEVLeaseID(ev.Attributes) + if err != nil { + return nil, err + } + price, err := parseEVPriceAttributes(ev.Attributes) + if err != nil { + return nil, err + } + return NewEventLeaseCreated(id, price), nil + case evActionLeaseClosed: + id, err := parseEVLeaseID(ev.Attributes) + if err != nil { + return nil, err + } + // optional price + price, _ := parseEVPriceAttributes(ev.Attributes) + return NewEventLeaseClosed(id, price), nil + + default: + return nil, sdkutil.ErrUnknownAction + } +} diff --git a/go/node/market/v1beta4/events_test.go b/go/node/market/v1beta4/events_test.go new file mode 100644 index 00000000..eab6ad81 --- /dev/null +++ b/go/node/market/v1beta4/events_test.go @@ -0,0 +1,460 @@ +package v1beta4 + +import ( + "fmt" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/pkg/errors" + + "github.com/stretchr/testify/require" + + "github.com/akash-network/akash-api/go/sdkutil" +) + +var ( + errWildcard = errors.New("wildcard string error can't be matched") + evOwnerKey = "owner" + evDSeqKey = "dseq" + evGSeqKey = "gseq" +) + +type testEventParsing struct { + msg sdkutil.Event + expErr error +} + +func (tep testEventParsing) testMessageType() func(t *testing.T) { + _, err := ParseEvent(tep.msg) + return func(t *testing.T) { + // if the error expected is errWildcard to catch untyped errors, don't fail the test, the error was expected. + if errors.Is(tep.expErr, errWildcard) { + require.Error(t, err) + } else { + require.Equal(t, tep.expErr, err) + } + } +} + +var TEPS = []testEventParsing{ + { + msg: sdkutil.Event{ + Type: "nil", + }, + expErr: sdkutil.ErrUnknownType, + }, + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + }, + expErr: sdkutil.ErrUnknownModule, + }, + + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + }, + expErr: sdkutil.ErrUnknownAction, + }, + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: "nil", + }, + expErr: sdkutil.ErrUnknownModule, + }, + + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: "nil", + }, + expErr: sdkutil.ErrUnknownAction, + }, + + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionOrderCreated, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + }, + }, + expErr: nil, + }, + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionOrderCreated, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "nooo", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + }, + }, + expErr: errWildcard, + }, + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionOrderCreated, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "abc", + }, + }, + }, + expErr: errWildcard, + }, + + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionOrderClosed, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + }, + }, + expErr: nil, + }, + + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionBidCreated, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + { + Key: evProviderKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evPriceDenomKey, + Value: "uakt", + }, + { + Key: evPriceAmountKey, + Value: "23", + }, + }, + }, + expErr: nil, + }, + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionBidCreated, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + { + Key: evProviderKey, + Value: "yesss", + }, + { + Key: evPriceDenomKey, + Value: "uakt", + }, + { + Key: evPriceAmountKey, + Value: "23", + }, + }, + }, + expErr: errWildcard, + }, + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionBidCreated, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + { + Key: evProviderKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evPriceDenomKey, + Value: "uakt", + }, + { + Key: evPriceAmountKey, + Value: "hello", + }, + }, + }, + expErr: errWildcard, + }, + + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionBidClosed, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + { + Key: evProviderKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evPriceDenomKey, + Value: "uakt", + }, + { + Key: evPriceAmountKey, + Value: "23", + }, + }, + }, + expErr: nil, + }, + + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionLeaseCreated, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + { + Key: evProviderKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evPriceDenomKey, + Value: "uakt", + }, + { + Key: evPriceAmountKey, + Value: "23", + }, + }, + }, + expErr: nil, + }, + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionLeaseCreated, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + { + Key: evProviderKey, + Value: "hello", + }, + { + Key: evPriceDenomKey, + Value: "uakt", + }, + { + Key: evPriceAmountKey, + Value: "23", + }, + }, + }, + expErr: errWildcard, + }, + + { + msg: sdkutil.Event{ + Type: sdkutil.EventTypeMessage, + Module: ModuleName, + Action: evActionLeaseClosed, + Attributes: []sdk.Attribute{ + { + Key: evOwnerKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evDSeqKey, + Value: "5", + }, + { + Key: evGSeqKey, + Value: "2", + }, + { + Key: evOSeqKey, + Value: "5", + }, + { + Key: evProviderKey, + Value: "akash1qtqpdszzakz7ugkey7ka2cmss95z26ygar2mgr", + }, + { + Key: evPriceDenomKey, + Value: "uakt", + }, + { + Key: evPriceAmountKey, + Value: "23", + }, + }, + }, + expErr: nil, + }, +} + +func TestEventParsing(t *testing.T) { + for i, test := range TEPS { + t.Run(fmt.Sprintf("%d", i), + test.testMessageType()) + } +} diff --git a/go/node/market/v1beta4/genesis.pb.go b/go/node/market/v1beta4/genesis.pb.go new file mode 100644 index 00000000..55e4deb4 --- /dev/null +++ b/go/node/market/v1beta4/genesis.pb.go @@ -0,0 +1,518 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: akash/market/v1beta4/genesis.proto + +package v1beta4 + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the basic genesis state used by market module +type GenesisState struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params" yaml:"params"` + Orders []Order `protobuf:"bytes,2,rep,name=orders,proto3" json:"orders" yaml:"orders"` + Leases []Lease `protobuf:"bytes,3,rep,name=leases,proto3" json:"leases" yaml:"leases"` + Bids []Bid `protobuf:"bytes,4,rep,name=bids,proto3" json:"bids" yaml:"bids"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_e52179524daaace5, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisState) GetOrders() []Order { + if m != nil { + return m.Orders + } + return nil +} + +func (m *GenesisState) GetLeases() []Lease { + if m != nil { + return m.Leases + } + return nil +} + +func (m *GenesisState) GetBids() []Bid { + if m != nil { + return m.Bids + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "akash.market.v1beta4.GenesisState") +} + +func init() { + proto.RegisterFile("akash/market/v1beta4/genesis.proto", fileDescriptor_e52179524daaace5) +} + +var fileDescriptor_e52179524daaace5 = []byte{ + // 339 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xb1, 0x4e, 0xeb, 0x30, + 0x14, 0x86, 0x93, 0xb6, 0xea, 0x90, 0xde, 0xbb, 0x44, 0x1d, 0x42, 0x8b, 0x9c, 0xe2, 0xa9, 0x0b, + 0xb6, 0x28, 0x2c, 0x30, 0x66, 0x41, 0x42, 0x48, 0xa0, 0x14, 0x16, 0x36, 0x87, 0x58, 0xa9, 0xd5, + 0xa6, 0xae, 0x6c, 0x03, 0xe2, 0x2d, 0x78, 0xac, 0x8e, 0x1d, 0x59, 0x88, 0x50, 0xbb, 0x31, 0xf6, + 0x09, 0x50, 0x6c, 0x4b, 0x91, 0x90, 0xd5, 0x2d, 0x7f, 0xfe, 0xef, 0x7c, 0xc9, 0xb1, 0x03, 0x48, + 0xe6, 0x44, 0xce, 0x70, 0x49, 0xc4, 0x9c, 0x2a, 0xfc, 0x7a, 0x96, 0x51, 0x45, 0x2e, 0x70, 0x41, + 0x97, 0x54, 0x32, 0x89, 0x56, 0x82, 0x2b, 0x1e, 0xf6, 0x35, 0x83, 0x0c, 0x83, 0x2c, 0x33, 0xe8, + 0x17, 0xbc, 0xe0, 0x1a, 0xc0, 0xf5, 0x93, 0x61, 0x07, 0x23, 0xa7, 0x8f, 0x8b, 0x9c, 0x8a, 0x83, + 0xc4, 0x82, 0x12, 0x49, 0x2d, 0x01, 0x9c, 0x44, 0xc6, 0x72, 0xdb, 0x9f, 0x38, 0xfb, 0x15, 0x11, + 0xa4, 0xb4, 0xbf, 0x0c, 0xbf, 0x5a, 0xc1, 0xbf, 0x6b, 0xb3, 0xc4, 0x54, 0x11, 0x45, 0xc3, 0xc7, + 0xa0, 0x6b, 0x80, 0xc8, 0x1f, 0xf9, 0xe3, 0xde, 0xe4, 0x18, 0xb9, 0x96, 0x42, 0xf7, 0x9a, 0x49, + 0xe2, 0x75, 0x15, 0x7b, 0x3f, 0x55, 0x6c, 0x67, 0xf6, 0x55, 0xfc, 0xff, 0x9d, 0x94, 0x8b, 0x2b, + 0x68, 0x32, 0x4c, 0x6d, 0x11, 0x3e, 0x04, 0x5d, 0xbd, 0x9b, 0x8c, 0x5a, 0xa3, 0xf6, 0xb8, 0x37, + 0x19, 0xba, 0xb5, 0x77, 0x35, 0xd3, 0x58, 0xcd, 0x48, 0x63, 0x35, 0x19, 0xa6, 0xb6, 0xa8, 0xad, + 0xfa, 0x3c, 0x64, 0xd4, 0x3e, 0x64, 0xbd, 0xad, 0x99, 0xc6, 0x6a, 0x46, 0x1a, 0xab, 0xc9, 0x30, + 0xb5, 0x45, 0x78, 0x13, 0x74, 0x32, 0x96, 0xcb, 0xa8, 0xa3, 0x9d, 0x47, 0x6e, 0x67, 0xc2, 0xf2, + 0x64, 0x68, 0x8d, 0x1a, 0xdf, 0x57, 0x71, 0xcf, 0xf8, 0xea, 0x04, 0x53, 0xfd, 0x32, 0x99, 0xae, + 0xb7, 0xc0, 0xdf, 0x6c, 0x81, 0xff, 0xbd, 0x05, 0xfe, 0xc7, 0x0e, 0x78, 0x9b, 0x1d, 0xf0, 0x3e, + 0x77, 0xc0, 0x7b, 0xba, 0x2c, 0x98, 0x9a, 0xbd, 0x64, 0xe8, 0x99, 0x97, 0x58, 0x7f, 0xe1, 0x74, + 0x49, 0xd5, 0x1b, 0x17, 0x73, 0x9b, 0xc8, 0x8a, 0xe1, 0x82, 0xe3, 0x25, 0xcf, 0xe9, 0x9f, 0x1b, + 0xcc, 0xba, 0xfa, 0xee, 0xce, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xd2, 0xfd, 0x9d, 0x36, 0x94, + 0x02, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = 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 = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Leases) > 0 { + for iNdEx := len(m.Leases) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Leases[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Orders) > 0 { + for iNdEx := len(m.Orders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Orders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.Orders) > 0 { + for _, e := range m.Orders { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Leases) > 0 { + for _, e := range m.Leases { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Bids) > 0 { + for _, e := range m.Bids { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Orders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Orders = append(m.Orders, Order{}) + if err := m.Orders[len(m.Orders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Leases", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Leases = append(m.Leases, Lease{}) + if err := m.Leases[len(m.Leases)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + 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 { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/go/node/market/v1beta4/id.go b/go/node/market/v1beta4/id.go new file mode 100644 index 00000000..c2f7a010 --- /dev/null +++ b/go/node/market/v1beta4/id.go @@ -0,0 +1,154 @@ +package v1beta4 + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + dtypes "github.com/akash-network/akash-api/go/node/deployment/v1beta3" +) + +// MakeOrderID returns OrderID instance with provided groupID details and oseq +func MakeOrderID(id dtypes.GroupID, oseq uint32) OrderID { + return OrderID{ + Owner: id.Owner, + DSeq: id.DSeq, + GSeq: id.GSeq, + OSeq: oseq, + } +} + +// GroupID method returns groupID details for specific order +func (id OrderID) GroupID() dtypes.GroupID { + return dtypes.GroupID{ + Owner: id.Owner, + DSeq: id.DSeq, + GSeq: id.GSeq, + } +} + +// Equals method compares specific order with provided order +func (id OrderID) Equals(other OrderID) bool { + return id.GroupID().Equals(other.GroupID()) && id.OSeq == other.OSeq +} + +// Validate method for OrderID and returns nil +func (id OrderID) Validate() error { + if err := id.GroupID().Validate(); err != nil { + return sdkerrors.Wrap(err, "OrderID: Invalid GroupID") + } + if id.OSeq == 0 { + return sdkerrors.Wrap(sdkerrors.ErrInvalidSequence, "OrderID: Invalid Order Sequence") + } + return nil +} + +// String provides stringer interface to save reflected formatting. +func (id OrderID) String() string { + return fmt.Sprintf("%s/%v", id.GroupID(), id.OSeq) +} + +// MakeBidID returns BidID instance with provided order details and provider +func MakeBidID(id OrderID, provider sdk.AccAddress) BidID { + return BidID{ + Owner: id.Owner, + DSeq: id.DSeq, + GSeq: id.GSeq, + OSeq: id.OSeq, + Provider: provider.String(), + } +} + +// Equals method compares specific bid with provided bid +func (id BidID) Equals(other BidID) bool { + return id.OrderID().Equals(other.OrderID()) && + id.Provider == other.Provider +} + +// LeaseID method returns lease details of bid +func (id BidID) LeaseID() LeaseID { + return LeaseID(id) +} + +// OrderID method returns OrderID details with specific bid details +func (id BidID) OrderID() OrderID { + return OrderID{ + Owner: id.Owner, + DSeq: id.DSeq, + GSeq: id.GSeq, + OSeq: id.OSeq, + } +} + +// String method for consistent output. +func (id BidID) String() string { + return fmt.Sprintf("%s/%v", id.OrderID(), id.Provider) +} + +// GroupID method returns GroupID details with specific bid details +func (id BidID) GroupID() dtypes.GroupID { + return id.OrderID().GroupID() +} + +// DeploymentID method returns deployment details with specific bid details +func (id BidID) DeploymentID() dtypes.DeploymentID { + return id.GroupID().DeploymentID() +} + +// Validate validates bid instance and returns nil +func (id BidID) Validate() error { + if err := id.OrderID().Validate(); err != nil { + return sdkerrors.Wrap(err, "BidID: Invalid OrderID") + } + if _, err := sdk.AccAddressFromBech32(id.Provider); err != nil { + return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "BidID: Invalid Provider Address") + } + if id.Owner == id.Provider { + return sdkerrors.Wrap(sdkerrors.ErrConflict, "BidID: self-bid") + } + return nil +} + +// MakeLeaseID returns LeaseID instance with provided bid details +func MakeLeaseID(id BidID) LeaseID { + return LeaseID(id) +} + +// Equals method compares specific lease with provided lease +func (id LeaseID) Equals(other LeaseID) bool { + return id.BidID().Equals(other.BidID()) +} + +// Validate calls the BidID's validator and returns any error. +func (id LeaseID) Validate() error { + if err := id.BidID().Validate(); err != nil { + return sdkerrors.Wrap(err, "LeaseID: Invalid BidID") + } + return nil +} + +// BidID method returns BidID details with specific LeaseID +func (id LeaseID) BidID() BidID { + return BidID(id) +} + +// OrderID method returns OrderID details with specific lease details +func (id LeaseID) OrderID() OrderID { + return id.BidID().OrderID() +} + +// GroupID method returns GroupID details with specific lease details +func (id LeaseID) GroupID() dtypes.GroupID { + return id.OrderID().GroupID() +} + +// DeploymentID method returns deployment details with specific lease details +func (id LeaseID) DeploymentID() dtypes.DeploymentID { + return id.GroupID().DeploymentID() +} + +// String method provides human readable representation of LeaseID. +func (id LeaseID) String() string { + return id.BidID().String() +} diff --git a/go/node/market/v1beta4/key.go b/go/node/market/v1beta4/key.go new file mode 100644 index 00000000..75026acf --- /dev/null +++ b/go/node/market/v1beta4/key.go @@ -0,0 +1,28 @@ +package v1beta4 + +const ( + // ModuleName is the module name constant used in many places + ModuleName = "market" + + // StoreKey is the store key string for market + StoreKey = ModuleName + + // RouterKey is the message route for market + RouterKey = ModuleName +) + +func OrderPrefix() []byte { + return []byte{0x01, 0x00} +} + +func BidPrefix() []byte { + return []byte{0x02, 0x00} +} + +func LeasePrefix() []byte { + return []byte{0x03, 0x00} +} + +func SecondaryLeasePrefix() []byte { + return []byte{0x03, 0x01} +} diff --git a/go/node/market/v1beta4/lease.pb.go b/go/node/market/v1beta4/lease.pb.go new file mode 100644 index 00000000..c5cbfe3a --- /dev/null +++ b/go/node/market/v1beta4/lease.pb.go @@ -0,0 +1,2134 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: akash/market/v1beta4/lease.proto + +package v1beta4 + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// State is an enum which refers to state of lease +type Lease_State int32 + +const ( + // Prefix should start with 0 in enum. So declaring dummy state + LeaseStateInvalid Lease_State = 0 + // LeaseActive denotes state for lease active + LeaseActive Lease_State = 1 + // LeaseInsufficientFunds denotes state for lease insufficient_funds + LeaseInsufficientFunds Lease_State = 2 + // LeaseClosed denotes state for lease closed + LeaseClosed Lease_State = 3 +) + +var Lease_State_name = map[int32]string{ + 0: "invalid", + 1: "active", + 2: "insufficient_funds", + 3: "closed", +} + +var Lease_State_value = map[string]int32{ + "invalid": 0, + "active": 1, + "insufficient_funds": 2, + "closed": 3, +} + +func (x Lease_State) String() string { + return proto.EnumName(Lease_State_name, int32(x)) +} + +func (Lease_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{1, 0} +} + +// LeaseID stores bid details of lease +type LeaseID struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner" yaml:"owner"` + DSeq uint64 `protobuf:"varint,2,opt,name=dseq,proto3" json:"dseq" yaml:"dseq"` + GSeq uint32 `protobuf:"varint,3,opt,name=gseq,proto3" json:"gseq" yaml:"gseq"` + OSeq uint32 `protobuf:"varint,4,opt,name=oseq,proto3" json:"oseq" yaml:"oseq"` + Provider string `protobuf:"bytes,5,opt,name=provider,proto3" json:"provider" yaml:"provider"` +} + +func (m *LeaseID) Reset() { *m = LeaseID{} } +func (*LeaseID) ProtoMessage() {} +func (*LeaseID) Descriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{0} +} +func (m *LeaseID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseID.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseID) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseID.Merge(m, src) +} +func (m *LeaseID) XXX_Size() int { + return m.Size() +} +func (m *LeaseID) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseID.DiscardUnknown(m) +} + +var xxx_messageInfo_LeaseID proto.InternalMessageInfo + +func (m *LeaseID) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *LeaseID) GetDSeq() uint64 { + if m != nil { + return m.DSeq + } + return 0 +} + +func (m *LeaseID) GetGSeq() uint32 { + if m != nil { + return m.GSeq + } + return 0 +} + +func (m *LeaseID) GetOSeq() uint32 { + if m != nil { + return m.OSeq + } + return 0 +} + +func (m *LeaseID) GetProvider() string { + if m != nil { + return m.Provider + } + return "" +} + +// Lease stores LeaseID, state of lease and price +type Lease struct { + LeaseID LeaseID `protobuf:"bytes,1,opt,name=lease_id,json=leaseId,proto3" json:"id" yaml:"id"` + State Lease_State `protobuf:"varint,2,opt,name=state,proto3,enum=akash.market.v1beta4.Lease_State" json:"state" yaml:"state"` + Price types.DecCoin `protobuf:"bytes,3,opt,name=price,proto3" json:"price" yaml:"price"` + CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + ClosedOn int64 `protobuf:"varint,5,opt,name=closed_on,json=closedOn,proto3" json:"closed_on,omitempty"` +} + +func (m *Lease) Reset() { *m = Lease{} } +func (*Lease) ProtoMessage() {} +func (*Lease) Descriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{1} +} +func (m *Lease) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Lease) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Lease.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Lease) XXX_Merge(src proto.Message) { + xxx_messageInfo_Lease.Merge(m, src) +} +func (m *Lease) XXX_Size() int { + return m.Size() +} +func (m *Lease) XXX_DiscardUnknown() { + xxx_messageInfo_Lease.DiscardUnknown(m) +} + +var xxx_messageInfo_Lease proto.InternalMessageInfo + +func (m *Lease) GetLeaseID() LeaseID { + if m != nil { + return m.LeaseID + } + return LeaseID{} +} + +func (m *Lease) GetState() Lease_State { + if m != nil { + return m.State + } + return LeaseStateInvalid +} + +func (m *Lease) GetPrice() types.DecCoin { + if m != nil { + return m.Price + } + return types.DecCoin{} +} + +func (m *Lease) GetCreatedAt() int64 { + if m != nil { + return m.CreatedAt + } + return 0 +} + +func (m *Lease) GetClosedOn() int64 { + if m != nil { + return m.ClosedOn + } + return 0 +} + +// LeaseFilters defines flags for lease list filter +type LeaseFilters struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner" yaml:"owner"` + DSeq uint64 `protobuf:"varint,2,opt,name=dseq,proto3" json:"dseq" yaml:"dseq"` + GSeq uint32 `protobuf:"varint,3,opt,name=gseq,proto3" json:"gseq" yaml:"gseq"` + OSeq uint32 `protobuf:"varint,4,opt,name=oseq,proto3" json:"oseq" yaml:"oseq"` + Provider string `protobuf:"bytes,5,opt,name=provider,proto3" json:"provider" yaml:"provider"` + State string `protobuf:"bytes,6,opt,name=state,proto3" json:"state" yaml:"state"` +} + +func (m *LeaseFilters) Reset() { *m = LeaseFilters{} } +func (m *LeaseFilters) String() string { return proto.CompactTextString(m) } +func (*LeaseFilters) ProtoMessage() {} +func (*LeaseFilters) Descriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{2} +} +func (m *LeaseFilters) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LeaseFilters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LeaseFilters.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *LeaseFilters) XXX_Merge(src proto.Message) { + xxx_messageInfo_LeaseFilters.Merge(m, src) +} +func (m *LeaseFilters) XXX_Size() int { + return m.Size() +} +func (m *LeaseFilters) XXX_DiscardUnknown() { + xxx_messageInfo_LeaseFilters.DiscardUnknown(m) +} + +var xxx_messageInfo_LeaseFilters proto.InternalMessageInfo + +func (m *LeaseFilters) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *LeaseFilters) GetDSeq() uint64 { + if m != nil { + return m.DSeq + } + return 0 +} + +func (m *LeaseFilters) GetGSeq() uint32 { + if m != nil { + return m.GSeq + } + return 0 +} + +func (m *LeaseFilters) GetOSeq() uint32 { + if m != nil { + return m.OSeq + } + return 0 +} + +func (m *LeaseFilters) GetProvider() string { + if m != nil { + return m.Provider + } + return "" +} + +func (m *LeaseFilters) GetState() string { + if m != nil { + return m.State + } + return "" +} + +// MsgCreateLease is sent to create a lease +type MsgCreateLease struct { + BidID BidID `protobuf:"bytes,1,opt,name=bid_id,json=bidId,proto3" json:"id" yaml:"id"` +} + +func (m *MsgCreateLease) Reset() { *m = MsgCreateLease{} } +func (m *MsgCreateLease) String() string { return proto.CompactTextString(m) } +func (*MsgCreateLease) ProtoMessage() {} +func (*MsgCreateLease) Descriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{3} +} +func (m *MsgCreateLease) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateLease) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateLease.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateLease) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateLease.Merge(m, src) +} +func (m *MsgCreateLease) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateLease) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateLease.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateLease proto.InternalMessageInfo + +func (m *MsgCreateLease) GetBidID() BidID { + if m != nil { + return m.BidID + } + return BidID{} +} + +// MsgCreateLeaseResponse is the response from creating a lease +type MsgCreateLeaseResponse struct { +} + +func (m *MsgCreateLeaseResponse) Reset() { *m = MsgCreateLeaseResponse{} } +func (m *MsgCreateLeaseResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateLeaseResponse) ProtoMessage() {} +func (*MsgCreateLeaseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{4} +} +func (m *MsgCreateLeaseResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateLeaseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateLeaseResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCreateLeaseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateLeaseResponse.Merge(m, src) +} +func (m *MsgCreateLeaseResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateLeaseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateLeaseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateLeaseResponse proto.InternalMessageInfo + +// MsgWithdrawLease defines an SDK message for closing bid +type MsgWithdrawLease struct { + LeaseID LeaseID `protobuf:"bytes,1,opt,name=bid_id,json=bidId,proto3" json:"id" yaml:"id"` +} + +func (m *MsgWithdrawLease) Reset() { *m = MsgWithdrawLease{} } +func (m *MsgWithdrawLease) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawLease) ProtoMessage() {} +func (*MsgWithdrawLease) Descriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{5} +} +func (m *MsgWithdrawLease) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawLease) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawLease.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawLease) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawLease.Merge(m, src) +} +func (m *MsgWithdrawLease) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawLease) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawLease.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawLease proto.InternalMessageInfo + +func (m *MsgWithdrawLease) GetLeaseID() LeaseID { + if m != nil { + return m.LeaseID + } + return LeaseID{} +} + +// MsgWithdrawLeaseResponse defines the Msg/WithdrawLease response type. +type MsgWithdrawLeaseResponse struct { +} + +func (m *MsgWithdrawLeaseResponse) Reset() { *m = MsgWithdrawLeaseResponse{} } +func (m *MsgWithdrawLeaseResponse) String() string { return proto.CompactTextString(m) } +func (*MsgWithdrawLeaseResponse) ProtoMessage() {} +func (*MsgWithdrawLeaseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{6} +} +func (m *MsgWithdrawLeaseResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgWithdrawLeaseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgWithdrawLeaseResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgWithdrawLeaseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgWithdrawLeaseResponse.Merge(m, src) +} +func (m *MsgWithdrawLeaseResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgWithdrawLeaseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgWithdrawLeaseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgWithdrawLeaseResponse proto.InternalMessageInfo + +// MsgCloseLease defines an SDK message for closing order +type MsgCloseLease struct { + LeaseID LeaseID `protobuf:"bytes,1,opt,name=lease_id,json=leaseId,proto3" json:"id" yaml:"id"` +} + +func (m *MsgCloseLease) Reset() { *m = MsgCloseLease{} } +func (m *MsgCloseLease) String() string { return proto.CompactTextString(m) } +func (*MsgCloseLease) ProtoMessage() {} +func (*MsgCloseLease) Descriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{7} +} +func (m *MsgCloseLease) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCloseLease) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCloseLease.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCloseLease) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCloseLease.Merge(m, src) +} +func (m *MsgCloseLease) XXX_Size() int { + return m.Size() +} +func (m *MsgCloseLease) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCloseLease.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCloseLease proto.InternalMessageInfo + +func (m *MsgCloseLease) GetLeaseID() LeaseID { + if m != nil { + return m.LeaseID + } + return LeaseID{} +} + +// MsgCloseLeaseResponse defines the Msg/CloseLease response type. +type MsgCloseLeaseResponse struct { +} + +func (m *MsgCloseLeaseResponse) Reset() { *m = MsgCloseLeaseResponse{} } +func (m *MsgCloseLeaseResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCloseLeaseResponse) ProtoMessage() {} +func (*MsgCloseLeaseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_4ab6faa2f1861aa1, []int{8} +} +func (m *MsgCloseLeaseResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCloseLeaseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCloseLeaseResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgCloseLeaseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCloseLeaseResponse.Merge(m, src) +} +func (m *MsgCloseLeaseResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCloseLeaseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCloseLeaseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCloseLeaseResponse proto.InternalMessageInfo + +func init() { + proto.RegisterEnum("akash.market.v1beta4.Lease_State", Lease_State_name, Lease_State_value) + proto.RegisterType((*LeaseID)(nil), "akash.market.v1beta4.LeaseID") + proto.RegisterType((*Lease)(nil), "akash.market.v1beta4.Lease") + proto.RegisterType((*LeaseFilters)(nil), "akash.market.v1beta4.LeaseFilters") + proto.RegisterType((*MsgCreateLease)(nil), "akash.market.v1beta4.MsgCreateLease") + proto.RegisterType((*MsgCreateLeaseResponse)(nil), "akash.market.v1beta4.MsgCreateLeaseResponse") + proto.RegisterType((*MsgWithdrawLease)(nil), "akash.market.v1beta4.MsgWithdrawLease") + proto.RegisterType((*MsgWithdrawLeaseResponse)(nil), "akash.market.v1beta4.MsgWithdrawLeaseResponse") + proto.RegisterType((*MsgCloseLease)(nil), "akash.market.v1beta4.MsgCloseLease") + proto.RegisterType((*MsgCloseLeaseResponse)(nil), "akash.market.v1beta4.MsgCloseLeaseResponse") +} + +func init() { proto.RegisterFile("akash/market/v1beta4/lease.proto", fileDescriptor_4ab6faa2f1861aa1) } + +var fileDescriptor_4ab6faa2f1861aa1 = []byte{ + // 756 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0x4f, 0x4f, 0xdb, 0x4a, + 0x10, 0xb7, 0x93, 0x38, 0x24, 0x1b, 0xfe, 0xe4, 0x59, 0xc0, 0xcb, 0x33, 0x0f, 0xdb, 0xf5, 0x89, + 0x4b, 0x6d, 0x11, 0x7a, 0x29, 0x3d, 0x11, 0x22, 0xaa, 0x48, 0x45, 0xa8, 0xa6, 0x52, 0xab, 0xaa, + 0x52, 0xe4, 0x78, 0x17, 0xb3, 0x22, 0xf1, 0x06, 0xaf, 0x09, 0xea, 0x37, 0xa8, 0x38, 0xf5, 0xd8, + 0x0b, 0x2a, 0x52, 0xbf, 0x0c, 0x47, 0xd4, 0x53, 0x4f, 0x56, 0x15, 0x2e, 0x55, 0x8e, 0x51, 0x3f, + 0x40, 0xb5, 0xbb, 0x0e, 0x49, 0x50, 0xc4, 0xa9, 0xea, 0xa9, 0xa7, 0x64, 0x7e, 0x33, 0xbf, 0x99, + 0xf1, 0x6f, 0x66, 0x6c, 0x60, 0x7a, 0x27, 0x1e, 0x3d, 0x76, 0x3a, 0x5e, 0x74, 0x82, 0x62, 0xa7, + 0xb7, 0xd9, 0x42, 0xb1, 0xf7, 0xc4, 0x69, 0x23, 0x8f, 0x22, 0xbb, 0x1b, 0x91, 0x98, 0xa8, 0xcb, + 0x3c, 0xc2, 0x16, 0x11, 0x76, 0x1a, 0xa1, 0x2d, 0x07, 0x24, 0x20, 0x3c, 0xc0, 0x61, 0xff, 0x44, + 0xac, 0xa6, 0xfb, 0x84, 0x76, 0x08, 0x75, 0x5a, 0x1e, 0x45, 0x69, 0xb2, 0x4d, 0xc7, 0x27, 0x38, + 0x1c, 0xf9, 0x67, 0x56, 0x6b, 0x61, 0x28, 0xfc, 0xd6, 0x55, 0x06, 0xcc, 0xbd, 0x60, 0xb5, 0x1b, + 0x75, 0xd5, 0x01, 0x0a, 0x39, 0x0f, 0x51, 0x54, 0x91, 0x4d, 0x79, 0xa3, 0x58, 0xfb, 0x6f, 0x90, + 0x18, 0x02, 0x18, 0x26, 0xc6, 0xfc, 0x7b, 0xaf, 0xd3, 0xde, 0xb6, 0xb8, 0x69, 0xb9, 0x02, 0x56, + 0xb7, 0x40, 0x0e, 0x52, 0x74, 0x5a, 0xc9, 0x98, 0xf2, 0x46, 0xae, 0x66, 0xf4, 0x13, 0x23, 0x57, + 0x3f, 0x44, 0xa7, 0x83, 0xc4, 0xe0, 0xf8, 0x30, 0x31, 0x4a, 0x82, 0xc6, 0x2c, 0xcb, 0xe5, 0x20, + 0x23, 0x05, 0x8c, 0x94, 0x35, 0xe5, 0x8d, 0x05, 0x41, 0x7a, 0x9e, 0x92, 0x82, 0x29, 0x52, 0x20, + 0x48, 0x41, 0x4a, 0x22, 0x8c, 0x94, 0x1b, 0x93, 0x0e, 0x52, 0x12, 0x99, 0x22, 0x11, 0x41, 0x62, + 0x3f, 0xea, 0x33, 0x50, 0xe8, 0x46, 0xa4, 0x87, 0x21, 0x8a, 0x2a, 0x0a, 0x7f, 0x24, 0x63, 0x90, + 0x18, 0x77, 0xd8, 0x30, 0x31, 0x96, 0x04, 0x69, 0x84, 0x58, 0xee, 0x9d, 0x73, 0xbb, 0xf0, 0xe9, + 0xca, 0x90, 0x7e, 0x5c, 0x19, 0x92, 0xf5, 0x33, 0x0b, 0x14, 0x2e, 0x91, 0xfa, 0x0e, 0x14, 0xf8, + 0x9c, 0x9a, 0x18, 0x72, 0x8d, 0x4a, 0xd5, 0x75, 0x7b, 0xd6, 0xac, 0xec, 0x54, 0xd1, 0x9a, 0x75, + 0x9d, 0x18, 0x52, 0x3f, 0x31, 0x46, 0x12, 0x0f, 0x12, 0x23, 0x83, 0xe1, 0x30, 0x31, 0x8a, 0xa2, + 0x30, 0x86, 0x96, 0x3b, 0xc7, 0x53, 0x36, 0xa0, 0xea, 0x02, 0x85, 0xc6, 0x5e, 0x8c, 0xb8, 0x9c, + 0x8b, 0xd5, 0x47, 0x0f, 0xa4, 0xb6, 0x0f, 0x59, 0xa0, 0x98, 0x10, 0xe7, 0x8c, 0x27, 0xc4, 0x4d, + 0xcb, 0x15, 0xb0, 0xfa, 0x12, 0x28, 0xdd, 0x08, 0xfb, 0x88, 0xab, 0x5d, 0xaa, 0xfe, 0x6f, 0x8b, + 0x75, 0xb1, 0xd9, 0xba, 0xa4, 0x29, 0x37, 0xed, 0x3a, 0xf2, 0x77, 0x09, 0x0e, 0x6b, 0xeb, 0xac, + 0x5b, 0x96, 0x92, 0x53, 0xc6, 0x29, 0xb9, 0x69, 0xb9, 0x02, 0x56, 0xd7, 0x01, 0xf0, 0x23, 0xe4, + 0xc5, 0x08, 0x36, 0xbd, 0x98, 0x0f, 0x24, 0xeb, 0x16, 0x53, 0x64, 0x27, 0x56, 0xd7, 0x40, 0xd1, + 0x6f, 0x13, 0x8a, 0x60, 0x93, 0x84, 0x5c, 0xf5, 0xac, 0x5b, 0x10, 0xc0, 0x41, 0x68, 0x7d, 0x96, + 0x81, 0xc2, 0x5b, 0x57, 0x2d, 0x30, 0x87, 0xc3, 0x9e, 0xd7, 0xc6, 0xb0, 0x2c, 0x69, 0x2b, 0x17, + 0x97, 0xe6, 0x3f, 0xfc, 0xc1, 0xb8, 0xb3, 0x21, 0x1c, 0xea, 0x1a, 0xc8, 0x7b, 0x7e, 0x8c, 0x7b, + 0xa8, 0x2c, 0x6b, 0x4b, 0x17, 0x97, 0x66, 0x89, 0x87, 0xec, 0x70, 0x48, 0xad, 0x02, 0x15, 0x87, + 0xf4, 0xec, 0xe8, 0x08, 0xfb, 0x18, 0x85, 0x71, 0xf3, 0xe8, 0x2c, 0x84, 0xb4, 0x9c, 0xd1, 0xb4, + 0x8b, 0x4b, 0x73, 0x55, 0xc8, 0x3d, 0xe1, 0xde, 0x63, 0x5e, 0x96, 0x50, 0xb4, 0x52, 0xce, 0x4e, + 0x24, 0xdc, 0xe5, 0x90, 0x96, 0xfb, 0xf0, 0x45, 0x97, 0x26, 0xc6, 0xfe, 0x35, 0x03, 0xe6, 0xb9, + 0x7f, 0x0f, 0xb7, 0x63, 0x14, 0xd1, 0xbf, 0xe7, 0x31, 0x71, 0x1e, 0x4c, 0x0c, 0xb1, 0xac, 0xf9, + 0xb1, 0x18, 0x0f, 0x6d, 0xe2, 0x76, 0x8e, 0x8b, 0xda, 0x06, 0x8b, 0xfb, 0x34, 0xd8, 0xe5, 0xdb, + 0x22, 0x6e, 0xea, 0x15, 0xc8, 0xb7, 0x30, 0x1c, 0x5f, 0xd4, 0xda, 0xec, 0xb5, 0xaf, 0x61, 0xd8, + 0xa8, 0xd7, 0xcc, 0xf4, 0x9e, 0x14, 0x6e, 0xce, 0xba, 0x26, 0xa5, 0x85, 0x61, 0x03, 0xa6, 0xd5, + 0x2a, 0x60, 0x75, 0xba, 0x9a, 0x8b, 0x68, 0x97, 0x84, 0x14, 0x59, 0x11, 0x28, 0xef, 0xd3, 0xe0, + 0x35, 0x8e, 0x8f, 0x61, 0xe4, 0x9d, 0x8b, 0x4e, 0xde, 0xdc, 0xeb, 0xe4, 0x37, 0xdc, 0xf6, 0x54, + 0x37, 0x1a, 0xa8, 0xdc, 0xaf, 0x79, 0xd7, 0x0f, 0x05, 0x0b, 0xac, 0x53, 0xb6, 0x89, 0x7f, 0xe0, + 0x55, 0x93, 0x36, 0xf4, 0x2f, 0x58, 0x99, 0x2a, 0x3a, 0xea, 0xa6, 0x76, 0x78, 0xdd, 0xd7, 0xe5, + 0x9b, 0xbe, 0x2e, 0x7f, 0xef, 0xeb, 0xf2, 0xc7, 0x5b, 0x5d, 0xba, 0xb9, 0xd5, 0xa5, 0x6f, 0xb7, + 0xba, 0xf4, 0xf6, 0x69, 0x80, 0xe3, 0xe3, 0xb3, 0x96, 0xed, 0x93, 0x8e, 0xc3, 0xdb, 0x79, 0x1c, + 0xa2, 0xf8, 0x9c, 0x44, 0x27, 0xa9, 0xe5, 0x75, 0xb1, 0x13, 0x10, 0x27, 0x24, 0x10, 0xdd, 0xfb, + 0xe6, 0xb4, 0xf2, 0xfc, 0x83, 0xb3, 0xf5, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xcd, 0xc4, 0x50, 0x62, + 0x00, 0x07, 0x00, 0x00, +} + +func (m *LeaseID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LeaseID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintLease(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x2a + } + if m.OSeq != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.OSeq)) + i-- + dAtA[i] = 0x20 + } + if m.GSeq != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.GSeq)) + i-- + dAtA[i] = 0x18 + } + if m.DSeq != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.DSeq)) + i-- + dAtA[i] = 0x10 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintLease(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Lease) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Lease) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Lease) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ClosedOn != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.ClosedOn)) + i-- + dAtA[i] = 0x28 + } + if m.CreatedAt != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.CreatedAt)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.Price.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLease(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.State != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.LeaseID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLease(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *LeaseFilters) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LeaseFilters) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LeaseFilters) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintLease(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0x32 + } + if len(m.Provider) > 0 { + i -= len(m.Provider) + copy(dAtA[i:], m.Provider) + i = encodeVarintLease(dAtA, i, uint64(len(m.Provider))) + i-- + dAtA[i] = 0x2a + } + if m.OSeq != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.OSeq)) + i-- + dAtA[i] = 0x20 + } + if m.GSeq != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.GSeq)) + i-- + dAtA[i] = 0x18 + } + if m.DSeq != 0 { + i = encodeVarintLease(dAtA, i, uint64(m.DSeq)) + i-- + dAtA[i] = 0x10 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintLease(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateLease) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateLease) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateLease) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.BidID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLease(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgCreateLeaseResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCreateLeaseResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateLeaseResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawLease) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawLease) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawLease) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LeaseID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLease(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgWithdrawLeaseResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgWithdrawLeaseResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgWithdrawLeaseResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgCloseLease) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCloseLease) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCloseLease) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LeaseID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintLease(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *MsgCloseLeaseResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgCloseLeaseResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCloseLeaseResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintLease(dAtA []byte, offset int, v uint64) int { + offset -= sovLease(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *LeaseID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovLease(uint64(l)) + } + if m.DSeq != 0 { + n += 1 + sovLease(uint64(m.DSeq)) + } + if m.GSeq != 0 { + n += 1 + sovLease(uint64(m.GSeq)) + } + if m.OSeq != 0 { + n += 1 + sovLease(uint64(m.OSeq)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovLease(uint64(l)) + } + return n +} + +func (m *Lease) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.LeaseID.Size() + n += 1 + l + sovLease(uint64(l)) + if m.State != 0 { + n += 1 + sovLease(uint64(m.State)) + } + l = m.Price.Size() + n += 1 + l + sovLease(uint64(l)) + if m.CreatedAt != 0 { + n += 1 + sovLease(uint64(m.CreatedAt)) + } + if m.ClosedOn != 0 { + n += 1 + sovLease(uint64(m.ClosedOn)) + } + return n +} + +func (m *LeaseFilters) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovLease(uint64(l)) + } + if m.DSeq != 0 { + n += 1 + sovLease(uint64(m.DSeq)) + } + if m.GSeq != 0 { + n += 1 + sovLease(uint64(m.GSeq)) + } + if m.OSeq != 0 { + n += 1 + sovLease(uint64(m.OSeq)) + } + l = len(m.Provider) + if l > 0 { + n += 1 + l + sovLease(uint64(l)) + } + l = len(m.State) + if l > 0 { + n += 1 + l + sovLease(uint64(l)) + } + return n +} + +func (m *MsgCreateLease) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.BidID.Size() + n += 1 + l + sovLease(uint64(l)) + return n +} + +func (m *MsgCreateLeaseResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgWithdrawLease) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.LeaseID.Size() + n += 1 + l + sovLease(uint64(l)) + return n +} + +func (m *MsgWithdrawLeaseResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgCloseLease) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.LeaseID.Size() + n += 1 + l + sovLease(uint64(l)) + return n +} + +func (m *MsgCloseLeaseResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovLease(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLease(x uint64) (n int) { + return sovLease(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *LeaseID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LeaseID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LeaseID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DSeq", wireType) + } + m.DSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DSeq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GSeq", wireType) + } + m.GSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OSeq", wireType) + } + m.OSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLease(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLease + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Lease) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Lease: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Lease: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LeaseID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LeaseID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= Lease_State(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Price.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + m.CreatedAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedAt |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClosedOn", wireType) + } + m.ClosedOn = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClosedOn |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipLease(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLease + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LeaseFilters) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LeaseFilters: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LeaseFilters: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DSeq", wireType) + } + m.DSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DSeq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GSeq", wireType) + } + m.GSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OSeq", wireType) + } + m.OSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Provider = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.State = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLease(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLease + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateLease) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateLease: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateLease: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BidID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLease(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLease + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateLeaseResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateLeaseResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateLeaseResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipLease(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLease + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawLease) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawLease: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawLease: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LeaseID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LeaseID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLease(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLease + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgWithdrawLeaseResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgWithdrawLeaseResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgWithdrawLeaseResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipLease(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLease + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCloseLease) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCloseLease: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCloseLease: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LeaseID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLease + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLease + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LeaseID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLease(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLease + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCloseLeaseResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLease + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCloseLeaseResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCloseLeaseResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipLease(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLease + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLease(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLease + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLease + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLease + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthLease + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLease + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLease + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLease = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLease = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLease = fmt.Errorf("proto: unexpected end of group") +) diff --git a/go/node/market/v1beta4/migrate/v1beta3.go b/go/node/market/v1beta4/migrate/v1beta3.go new file mode 100644 index 00000000..f87f9b94 --- /dev/null +++ b/go/node/market/v1beta4/migrate/v1beta3.go @@ -0,0 +1,40 @@ +package migrate + +import ( + "github.com/akash-network/akash-api/go/node/market/v1beta3" + "github.com/akash-network/akash-api/go/node/market/v1beta4" +) + +func BidStateFromV1beta3(from v1beta3.Bid_State) v1beta4.Bid_State { + return v1beta4.Bid_State(from) +} + +func LeaseIDFromV1beta3(from v1beta3.LeaseID) v1beta4.LeaseID { + return v1beta4.LeaseID{ + Owner: from.Owner, + DSeq: from.DSeq, + GSeq: from.GSeq, + OSeq: from.OSeq, + Provider: from.Provider, + } +} + +func BidIDFromV1beta3(from v1beta3.BidID) v1beta4.BidID { + return v1beta4.BidID{ + Owner: from.Owner, + DSeq: from.DSeq, + GSeq: from.GSeq, + OSeq: from.OSeq, + Provider: from.Provider, + } +} + +func BidFromV1beta3(from v1beta3.Bid) v1beta4.Bid { + return v1beta4.Bid{ + BidID: BidIDFromV1beta3(from.BidID), + State: BidStateFromV1beta3(from.State), + Price: from.Price, + CreatedAt: from.CreatedAt, + ResourcesOffer: v1beta4.ResourcesOffer{}, + } +} diff --git a/go/node/market/v1beta4/msgs.go b/go/node/market/v1beta4/msgs.go new file mode 100644 index 00000000..e58d70a2 --- /dev/null +++ b/go/node/market/v1beta4/msgs.go @@ -0,0 +1,215 @@ +package v1beta4 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pkg/errors" +) + +const ( + MsgTypeCreateBid = "create-bid" + MsgTypeCloseBid = "close-bid" + MsgTypeCreateLease = "create-lease" + MsgTypeWithdrawLease = "withdraw-lease" + MsgTypeCloseLease = "close-lease" +) + +var ( + _ sdk.Msg = &MsgCreateBid{} + _ sdk.Msg = &MsgCloseBid{} + _ sdk.Msg = &MsgCreateLease{} + _ sdk.Msg = &MsgWithdrawLease{} + _ sdk.Msg = &MsgCloseLease{} +) + +// NewMsgCreateBid creates a new MsgCreateBid instance +func NewMsgCreateBid(id OrderID, provider sdk.AccAddress, price sdk.DecCoin, deposit sdk.Coin) *MsgCreateBid { + return &MsgCreateBid{ + Order: id, + Provider: provider.String(), + Price: price, + Deposit: deposit, + } +} + +// Route implements the sdk.Msg interface +func (msg MsgCreateBid) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface +func (msg MsgCreateBid) Type() string { return MsgTypeCreateBid } + +// GetSignBytes encodes the message for signing +func (msg MsgCreateBid) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners defines whose signature is required +func (msg MsgCreateBid) GetSigners() []sdk.AccAddress { + provider, err := sdk.AccAddressFromBech32(msg.Provider) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{provider} +} + +// ValidateBasic does basic validation of provider and order +func (msg MsgCreateBid) ValidateBasic() error { + if err := msg.Order.Validate(); err != nil { + return err + } + + provider, err := sdk.AccAddressFromBech32(msg.Provider) + if err != nil { + return ErrEmptyProvider + } + + owner, err := sdk.AccAddressFromBech32(msg.Order.Owner) + if err != nil { + return errors.Wrap(ErrInvalidBid, "empty owner") + } + + if provider.Equals(owner) { + return ErrSameAccount + } + + if msg.Price.IsZero() { + return ErrBidZeroPrice + } + + return nil +} + +// NewMsgWithdrawLease creates a new MsgWithdrawLease instance +func NewMsgWithdrawLease(id LeaseID) *MsgWithdrawLease { + return &MsgWithdrawLease{ + LeaseID: id, + } +} + +// Route implements the sdk.Msg interface +func (msg MsgWithdrawLease) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface +func (msg MsgWithdrawLease) Type() string { return MsgTypeWithdrawLease } + +// GetSignBytes encodes the message for signing +func (msg MsgWithdrawLease) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners defines whose signature is required +func (msg MsgWithdrawLease) GetSigners() []sdk.AccAddress { + provider, err := sdk.AccAddressFromBech32(msg.GetLeaseID().Provider) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{provider} +} + +// ValidateBasic does basic validation of provider and order +func (msg MsgWithdrawLease) ValidateBasic() error { + if err := msg.LeaseID.Validate(); err != nil { + return err + } + return nil +} + +// NewMsgCreateLease creates a new MsgCreateLease instance +func NewMsgCreateLease(id BidID) *MsgCreateLease { + return &MsgCreateLease{ + BidID: id, + } +} + +// Route implements the sdk.Msg interface +func (msg MsgCreateLease) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface +func (msg MsgCreateLease) Type() string { return MsgTypeCreateLease } + +// GetSignBytes encodes the message for signing +func (msg MsgCreateLease) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners defines whose signature is required +func (msg MsgCreateLease) GetSigners() []sdk.AccAddress { + provider, err := sdk.AccAddressFromBech32(msg.BidID.Owner) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{provider} +} + +// ValidateBasic method for MsgCreateLease +func (msg MsgCreateLease) ValidateBasic() error { + return msg.BidID.Validate() +} + +// NewMsgCloseBid creates a new MsgCloseBid instance +func NewMsgCloseBid(id BidID) *MsgCloseBid { + return &MsgCloseBid{ + BidID: id, + } +} + +// Route implements the sdk.Msg interface +func (msg MsgCloseBid) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface +func (msg MsgCloseBid) Type() string { return MsgTypeCloseBid } + +// GetSignBytes encodes the message for signing +func (msg MsgCloseBid) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners defines whose signature is required +func (msg MsgCloseBid) GetSigners() []sdk.AccAddress { + provider, err := sdk.AccAddressFromBech32(msg.BidID.Provider) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{provider} +} + +// ValidateBasic method for MsgCloseBid +func (msg MsgCloseBid) ValidateBasic() error { + return msg.BidID.Validate() +} + +// NewMsgCloseLease creates a new MsgCloseLease instance +func NewMsgCloseLease(id LeaseID) *MsgCloseLease { + return &MsgCloseLease{ + LeaseID: id, + } +} + +// Route implements the sdk.Msg interface +func (msg MsgCloseLease) Route() string { return RouterKey } + +// Type implements the sdk.Msg interface +func (msg MsgCloseLease) Type() string { return MsgTypeCloseLease } + +// GetSignBytes encodes the message for signing +func (msg MsgCloseLease) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) +} + +// GetSigners defines whose signature is required +func (msg MsgCloseLease) GetSigners() []sdk.AccAddress { + owner, err := sdk.AccAddressFromBech32(msg.LeaseID.Owner) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{owner} +} + +// ValidateBasic method for MsgCloseLease +func (msg MsgCloseLease) ValidateBasic() error { + return msg.LeaseID.Validate() +} diff --git a/go/node/market/v1beta4/order.pb.go b/go/node/market/v1beta4/order.pb.go new file mode 100644 index 00000000..fbf5abc5 --- /dev/null +++ b/go/node/market/v1beta4/order.pb.go @@ -0,0 +1,1107 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: akash/market/v1beta4/order.proto + +package v1beta4 + +import ( + fmt "fmt" + v1beta3 "github.com/akash-network/akash-api/go/node/deployment/v1beta3" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// State is an enum which refers to state of order +type Order_State int32 + +const ( + // Prefix should start with 0 in enum. So declaring dummy state + OrderStateInvalid Order_State = 0 + // OrderOpen denotes state for order open + OrderOpen Order_State = 1 + // OrderMatched denotes state for order matched + OrderActive Order_State = 2 + // OrderClosed denotes state for order lost + OrderClosed Order_State = 3 +) + +var Order_State_name = map[int32]string{ + 0: "invalid", + 1: "open", + 2: "active", + 3: "closed", +} + +var Order_State_value = map[string]int32{ + "invalid": 0, + "open": 1, + "active": 2, + "closed": 3, +} + +func (x Order_State) String() string { + return proto.EnumName(Order_State_name, int32(x)) +} + +func (Order_State) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_f7500a2881510f8f, []int{1, 0} +} + +// OrderID stores owner and all other seq numbers +type OrderID struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner" yaml:"owner"` + DSeq uint64 `protobuf:"varint,2,opt,name=dseq,proto3" json:"dseq" yaml:"dseq"` + GSeq uint32 `protobuf:"varint,3,opt,name=gseq,proto3" json:"gseq" yaml:"gseq"` + OSeq uint32 `protobuf:"varint,4,opt,name=oseq,proto3" json:"oseq" yaml:"oseq"` +} + +func (m *OrderID) Reset() { *m = OrderID{} } +func (*OrderID) ProtoMessage() {} +func (*OrderID) Descriptor() ([]byte, []int) { + return fileDescriptor_f7500a2881510f8f, []int{0} +} +func (m *OrderID) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OrderID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OrderID.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OrderID) XXX_Merge(src proto.Message) { + xxx_messageInfo_OrderID.Merge(m, src) +} +func (m *OrderID) XXX_Size() int { + return m.Size() +} +func (m *OrderID) XXX_DiscardUnknown() { + xxx_messageInfo_OrderID.DiscardUnknown(m) +} + +var xxx_messageInfo_OrderID proto.InternalMessageInfo + +func (m *OrderID) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *OrderID) GetDSeq() uint64 { + if m != nil { + return m.DSeq + } + return 0 +} + +func (m *OrderID) GetGSeq() uint32 { + if m != nil { + return m.GSeq + } + return 0 +} + +func (m *OrderID) GetOSeq() uint32 { + if m != nil { + return m.OSeq + } + return 0 +} + +// Order stores orderID, state of order and other details +type Order struct { + OrderID OrderID `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"id" yaml:"id"` + State Order_State `protobuf:"varint,2,opt,name=state,proto3,enum=akash.market.v1beta4.Order_State" json:"state" yaml:"state"` + Spec v1beta3.GroupSpec `protobuf:"bytes,3,opt,name=spec,proto3" json:"spec" yaml:"spec"` + CreatedAt int64 `protobuf:"varint,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` +} + +func (m *Order) Reset() { *m = Order{} } +func (*Order) ProtoMessage() {} +func (*Order) Descriptor() ([]byte, []int) { + return fileDescriptor_f7500a2881510f8f, []int{1} +} +func (m *Order) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Order) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Order.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Order) XXX_Merge(src proto.Message) { + xxx_messageInfo_Order.Merge(m, src) +} +func (m *Order) XXX_Size() int { + return m.Size() +} +func (m *Order) XXX_DiscardUnknown() { + xxx_messageInfo_Order.DiscardUnknown(m) +} + +var xxx_messageInfo_Order proto.InternalMessageInfo + +func (m *Order) GetOrderID() OrderID { + if m != nil { + return m.OrderID + } + return OrderID{} +} + +func (m *Order) GetState() Order_State { + if m != nil { + return m.State + } + return OrderStateInvalid +} + +func (m *Order) GetSpec() v1beta3.GroupSpec { + if m != nil { + return m.Spec + } + return v1beta3.GroupSpec{} +} + +func (m *Order) GetCreatedAt() int64 { + if m != nil { + return m.CreatedAt + } + return 0 +} + +// OrderFilters defines flags for order list filter +type OrderFilters struct { + Owner string `protobuf:"bytes,1,opt,name=owner,proto3" json:"owner" yaml:"owner"` + DSeq uint64 `protobuf:"varint,2,opt,name=dseq,proto3" json:"dseq" yaml:"dseq"` + GSeq uint32 `protobuf:"varint,3,opt,name=gseq,proto3" json:"gseq" yaml:"gseq"` + OSeq uint32 `protobuf:"varint,4,opt,name=oseq,proto3" json:"oseq" yaml:"oseq"` + State string `protobuf:"bytes,5,opt,name=state,proto3" json:"state" yaml:"state"` +} + +func (m *OrderFilters) Reset() { *m = OrderFilters{} } +func (m *OrderFilters) String() string { return proto.CompactTextString(m) } +func (*OrderFilters) ProtoMessage() {} +func (*OrderFilters) Descriptor() ([]byte, []int) { + return fileDescriptor_f7500a2881510f8f, []int{2} +} +func (m *OrderFilters) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *OrderFilters) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_OrderFilters.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *OrderFilters) XXX_Merge(src proto.Message) { + xxx_messageInfo_OrderFilters.Merge(m, src) +} +func (m *OrderFilters) XXX_Size() int { + return m.Size() +} +func (m *OrderFilters) XXX_DiscardUnknown() { + xxx_messageInfo_OrderFilters.DiscardUnknown(m) +} + +var xxx_messageInfo_OrderFilters proto.InternalMessageInfo + +func (m *OrderFilters) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *OrderFilters) GetDSeq() uint64 { + if m != nil { + return m.DSeq + } + return 0 +} + +func (m *OrderFilters) GetGSeq() uint32 { + if m != nil { + return m.GSeq + } + return 0 +} + +func (m *OrderFilters) GetOSeq() uint32 { + if m != nil { + return m.OSeq + } + return 0 +} + +func (m *OrderFilters) GetState() string { + if m != nil { + return m.State + } + return "" +} + +func init() { + proto.RegisterEnum("akash.market.v1beta4.Order_State", Order_State_name, Order_State_value) + proto.RegisterType((*OrderID)(nil), "akash.market.v1beta4.OrderID") + proto.RegisterType((*Order)(nil), "akash.market.v1beta4.Order") + proto.RegisterType((*OrderFilters)(nil), "akash.market.v1beta4.OrderFilters") +} + +func init() { proto.RegisterFile("akash/market/v1beta4/order.proto", fileDescriptor_f7500a2881510f8f) } + +var fileDescriptor_f7500a2881510f8f = []byte{ + // 587 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x54, 0xb1, 0x6b, 0xdb, 0x4e, + 0x14, 0x96, 0x6c, 0x39, 0x89, 0xcf, 0xc9, 0xef, 0xe7, 0x8a, 0x94, 0xa6, 0x0a, 0xd1, 0xa9, 0xea, + 0xe2, 0xa5, 0x12, 0xb5, 0xbb, 0xd4, 0x5b, 0xdc, 0xd0, 0xe0, 0xc9, 0x20, 0x77, 0x2a, 0x85, 0x20, + 0xeb, 0x0e, 0x45, 0xd8, 0xd6, 0x29, 0xd2, 0xc5, 0x21, 0x7b, 0x87, 0xe2, 0xa9, 0x4b, 0xa1, 0x8b, + 0x21, 0xd0, 0x3f, 0xa4, 0x6b, 0xc6, 0x8c, 0x9d, 0x44, 0xb1, 0x97, 0xe2, 0xd1, 0x7f, 0x41, 0xb9, + 0x77, 0x0a, 0x4e, 0x4a, 0xc9, 0x1f, 0xd0, 0x49, 0x7a, 0xdf, 0xfb, 0xbe, 0x77, 0xf7, 0xbe, 0xf7, + 0x38, 0x64, 0xf9, 0x43, 0x3f, 0x3b, 0x75, 0xc7, 0x7e, 0x3a, 0xa4, 0xdc, 0x9d, 0xbc, 0x1c, 0x50, + 0xee, 0xbf, 0x72, 0x59, 0x4a, 0x68, 0xea, 0x24, 0x29, 0xe3, 0x4c, 0xdf, 0x05, 0x86, 0x23, 0x19, + 0x4e, 0xc1, 0x30, 0x76, 0x43, 0x16, 0x32, 0x20, 0xb8, 0xe2, 0x4f, 0x72, 0x8d, 0x86, 0xac, 0x46, + 0x68, 0x32, 0x62, 0x97, 0x63, 0x1a, 0xdf, 0x56, 0x6c, 0xb9, 0x61, 0xca, 0xce, 0x93, 0x2c, 0xa1, + 0x81, 0x64, 0xda, 0x0b, 0x15, 0x6d, 0xf6, 0xc4, 0x29, 0xdd, 0x23, 0xdd, 0x45, 0x15, 0x76, 0x11, + 0xd3, 0x74, 0x4f, 0xb5, 0xd4, 0x46, 0xb5, 0xf3, 0x74, 0x99, 0x63, 0x09, 0xac, 0x72, 0xbc, 0x7d, + 0xe9, 0x8f, 0x47, 0x6d, 0x1b, 0x42, 0xdb, 0x93, 0xb0, 0xde, 0x42, 0x1a, 0xc9, 0xe8, 0xd9, 0x5e, + 0xc9, 0x52, 0x1b, 0x5a, 0x07, 0xcf, 0x73, 0xac, 0x1d, 0xf5, 0xe9, 0xd9, 0x32, 0xc7, 0x80, 0xaf, + 0x72, 0x5c, 0x93, 0x32, 0x11, 0xd9, 0x1e, 0x80, 0x42, 0x14, 0x0a, 0x51, 0xd9, 0x52, 0x1b, 0x3b, + 0x52, 0x74, 0x5c, 0x88, 0xc2, 0x7b, 0xa2, 0x50, 0x8a, 0xc2, 0x42, 0xc4, 0x84, 0x48, 0x5b, 0x8b, + 0x7a, 0x85, 0x88, 0xdd, 0x13, 0x31, 0x29, 0x12, 0x9f, 0xf6, 0xd6, 0xd7, 0x2b, 0xac, 0xfc, 0xba, + 0xc2, 0x8a, 0xfd, 0xbd, 0x8c, 0x2a, 0xd0, 0xa5, 0xfe, 0x01, 0x6d, 0x81, 0xa9, 0x27, 0x11, 0x81, + 0x36, 0x6b, 0xcd, 0x03, 0xe7, 0x6f, 0xc6, 0x3a, 0x85, 0x29, 0x1d, 0xfb, 0x3a, 0xc7, 0xca, 0x3c, + 0xc7, 0xb7, 0x2e, 0x2d, 0x73, 0x5c, 0x8a, 0xc8, 0x2a, 0xc7, 0x55, 0x79, 0x60, 0x44, 0x6c, 0x6f, + 0x13, 0x4a, 0x76, 0x89, 0xee, 0xa1, 0x4a, 0xc6, 0x7d, 0x4e, 0xc1, 0x91, 0xff, 0x9a, 0xcf, 0x1e, + 0x28, 0xed, 0xf4, 0x05, 0x51, 0x9a, 0x0c, 0x9a, 0xb5, 0xc9, 0x10, 0xda, 0x9e, 0x84, 0xf5, 0x77, + 0x48, 0x13, 0xf3, 0x02, 0xbf, 0x6a, 0xcd, 0xe7, 0x45, 0xc9, 0xf5, 0x68, 0x8b, 0xb2, 0x2d, 0xe7, + 0x58, 0x8c, 0xb6, 0x9f, 0xd0, 0xa0, 0xb3, 0x2f, 0xee, 0x2c, 0xbc, 0x11, 0xc2, 0xb5, 0x37, 0x22, + 0xb2, 0x3d, 0x00, 0xf5, 0x03, 0x84, 0x82, 0x94, 0xfa, 0x9c, 0x92, 0x13, 0x9f, 0x83, 0xad, 0x65, + 0xaf, 0x5a, 0x20, 0x87, 0xdc, 0xfe, 0xa8, 0xa2, 0x0a, 0x5c, 0x50, 0xb7, 0xd1, 0x66, 0x14, 0x4f, + 0xfc, 0x51, 0x44, 0xea, 0x8a, 0xf1, 0x78, 0x3a, 0xb3, 0x1e, 0xc1, 0xf5, 0x21, 0xd9, 0x95, 0x09, + 0xfd, 0x09, 0xd2, 0x58, 0x42, 0xe3, 0xba, 0x6a, 0xec, 0x4c, 0x67, 0x56, 0x15, 0x08, 0xbd, 0x84, + 0xc6, 0xfa, 0x3e, 0xda, 0xf0, 0x03, 0x1e, 0x4d, 0x68, 0xbd, 0x64, 0xfc, 0x3f, 0x9d, 0x59, 0x35, + 0x48, 0x1d, 0x02, 0x24, 0x92, 0xc1, 0x88, 0x65, 0x94, 0xd4, 0xcb, 0x77, 0x92, 0x6f, 0x00, 0x32, + 0xb4, 0x4f, 0xdf, 0x4c, 0xe5, 0xce, 0x04, 0xbf, 0x94, 0xd0, 0x36, 0xe4, 0xdf, 0x46, 0x23, 0x4e, + 0xd3, 0xec, 0x5f, 0x5b, 0x56, 0xd1, 0x8f, 0x5c, 0x9d, 0xca, 0xba, 0x9f, 0x87, 0xf6, 0xa2, 0xad, + 0x09, 0x5f, 0x3a, 0xfd, 0xeb, 0xb9, 0xa9, 0xde, 0xcc, 0x4d, 0xf5, 0xe7, 0xdc, 0x54, 0x3f, 0x2f, + 0x4c, 0xe5, 0x66, 0x61, 0x2a, 0x3f, 0x16, 0xa6, 0xf2, 0xfe, 0x75, 0x18, 0xf1, 0xd3, 0xf3, 0x81, + 0x13, 0xb0, 0xb1, 0x0b, 0x3b, 0xf3, 0x22, 0xa6, 0xfc, 0x82, 0xa5, 0xc3, 0x22, 0xf2, 0x93, 0xc8, + 0x0d, 0x99, 0x1b, 0x33, 0x42, 0xff, 0x78, 0x76, 0x06, 0x1b, 0xf0, 0x36, 0xb4, 0x7e, 0x07, 0x00, + 0x00, 0xff, 0xff, 0x9c, 0xe7, 0x69, 0x2b, 0x95, 0x04, 0x00, 0x00, +} + +func (m *OrderID) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OrderID) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OrderID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OSeq != 0 { + i = encodeVarintOrder(dAtA, i, uint64(m.OSeq)) + i-- + dAtA[i] = 0x20 + } + if m.GSeq != 0 { + i = encodeVarintOrder(dAtA, i, uint64(m.GSeq)) + i-- + dAtA[i] = 0x18 + } + if m.DSeq != 0 { + i = encodeVarintOrder(dAtA, i, uint64(m.DSeq)) + i-- + dAtA[i] = 0x10 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintOrder(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Order) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Order) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Order) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CreatedAt != 0 { + i = encodeVarintOrder(dAtA, i, uint64(m.CreatedAt)) + i-- + dAtA[i] = 0x20 + } + { + size, err := m.Spec.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOrder(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if m.State != 0 { + i = encodeVarintOrder(dAtA, i, uint64(m.State)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.OrderID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintOrder(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *OrderFilters) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *OrderFilters) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *OrderFilters) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.State) > 0 { + i -= len(m.State) + copy(dAtA[i:], m.State) + i = encodeVarintOrder(dAtA, i, uint64(len(m.State))) + i-- + dAtA[i] = 0x2a + } + if m.OSeq != 0 { + i = encodeVarintOrder(dAtA, i, uint64(m.OSeq)) + i-- + dAtA[i] = 0x20 + } + if m.GSeq != 0 { + i = encodeVarintOrder(dAtA, i, uint64(m.GSeq)) + i-- + dAtA[i] = 0x18 + } + if m.DSeq != 0 { + i = encodeVarintOrder(dAtA, i, uint64(m.DSeq)) + i-- + dAtA[i] = 0x10 + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintOrder(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintOrder(dAtA []byte, offset int, v uint64) int { + offset -= sovOrder(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *OrderID) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovOrder(uint64(l)) + } + if m.DSeq != 0 { + n += 1 + sovOrder(uint64(m.DSeq)) + } + if m.GSeq != 0 { + n += 1 + sovOrder(uint64(m.GSeq)) + } + if m.OSeq != 0 { + n += 1 + sovOrder(uint64(m.OSeq)) + } + return n +} + +func (m *Order) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.OrderID.Size() + n += 1 + l + sovOrder(uint64(l)) + if m.State != 0 { + n += 1 + sovOrder(uint64(m.State)) + } + l = m.Spec.Size() + n += 1 + l + sovOrder(uint64(l)) + if m.CreatedAt != 0 { + n += 1 + sovOrder(uint64(m.CreatedAt)) + } + return n +} + +func (m *OrderFilters) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovOrder(uint64(l)) + } + if m.DSeq != 0 { + n += 1 + sovOrder(uint64(m.DSeq)) + } + if m.GSeq != 0 { + n += 1 + sovOrder(uint64(m.GSeq)) + } + if m.OSeq != 0 { + n += 1 + sovOrder(uint64(m.OSeq)) + } + l = len(m.State) + if l > 0 { + n += 1 + l + sovOrder(uint64(l)) + } + return n +} + +func sovOrder(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozOrder(x uint64) (n int) { + return sovOrder(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *OrderID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OrderID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OrderID: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOrder + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOrder + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DSeq", wireType) + } + m.DSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DSeq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GSeq", wireType) + } + m.GSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OSeq", wireType) + } + m.OSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOrder(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOrder + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Order) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Order: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Order: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOrder + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOrder + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OrderID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + m.State = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.State |= Order_State(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthOrder + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthOrder + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Spec.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CreatedAt", wireType) + } + m.CreatedAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CreatedAt |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipOrder(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOrder + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *OrderFilters) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: OrderFilters: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: OrderFilters: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOrder + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOrder + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DSeq", wireType) + } + m.DSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DSeq |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field GSeq", wireType) + } + m.GSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.GSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OSeq", wireType) + } + m.OSeq = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OSeq |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOrder + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthOrder + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthOrder + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.State = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipOrder(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOrder + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipOrder(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOrder + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOrder + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowOrder + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthOrder + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupOrder + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthOrder + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthOrder = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowOrder = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupOrder = fmt.Errorf("proto: unexpected end of group") +) diff --git a/go/node/market/v1beta4/params.go b/go/node/market/v1beta4/params.go new file mode 100644 index 00000000..6467b99d --- /dev/null +++ b/go/node/market/v1beta4/params.go @@ -0,0 +1,76 @@ +package v1beta4 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/pkg/errors" +) + +var _ paramtypes.ParamSet = (*Params)(nil) + +var ( + DefaultBidMinDeposit = sdk.NewCoin("uakt", sdk.NewInt(5000000)) + defaultOrderMaxBids uint32 = 20 + maxOrderMaxBids uint32 = 500 +) + +const ( + keyBidMinDeposit = "BidMinDeposit" + keyOrderMaxBids = "OrderMaxBids" +) + +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair([]byte(keyBidMinDeposit), &p.BidMinDeposit, validateCoin), + paramtypes.NewParamSetPair([]byte(keyOrderMaxBids), &p.OrderMaxBids, validateOrderMaxBids), + } +} + +func DefaultParams() Params { + return Params{ + BidMinDeposit: DefaultBidMinDeposit, + OrderMaxBids: defaultOrderMaxBids, + } +} + +func (p Params) Validate() error { + if err := validateCoin(p.BidMinDeposit); err != nil { + return err + } + + if err := validateOrderMaxBids(p.OrderMaxBids); err != nil { + return err + } + return nil +} + +func validateCoin(i interface{}) error { + _, ok := i.(sdk.Coin) + if !ok { + return errors.Wrapf(ErrInvalidParam, "invalid type %T", i) + } + + return nil +} + +func validateOrderMaxBids(i interface{}) error { + val, ok := i.(uint32) + + if !ok { + return errors.Wrapf(ErrInvalidParam, "invalid type %T", i) + } + + if val == 0 { + return errors.Wrap(ErrInvalidParam, "order max bids too low") + } + + if val > maxOrderMaxBids { + return errors.Wrap(ErrInvalidParam, "order max bids too high") + } + + return nil +} diff --git a/go/node/market/v1beta4/params.pb.go b/go/node/market/v1beta4/params.pb.go new file mode 100644 index 00000000..a454cdf4 --- /dev/null +++ b/go/node/market/v1beta4/params.pb.go @@ -0,0 +1,365 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: akash/market/v1beta4/params.proto + +package v1beta4 + +import ( + fmt "fmt" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params is the params for the x/market module +type Params struct { + BidMinDeposit types.Coin `protobuf:"bytes,1,opt,name=bid_min_deposit,json=bidMinDeposit,proto3" json:"bid_min_deposit" yaml:"bid_min_deposit"` + OrderMaxBids uint32 `protobuf:"varint,2,opt,name=order_max_bids,json=orderMaxBids,proto3" json:"order_max_bids" yaml:"order_max_bids"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_80f1e7d9604b0c57, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetBidMinDeposit() types.Coin { + if m != nil { + return m.BidMinDeposit + } + return types.Coin{} +} + +func (m *Params) GetOrderMaxBids() uint32 { + if m != nil { + return m.OrderMaxBids + } + return 0 +} + +func init() { + proto.RegisterType((*Params)(nil), "akash.market.v1beta4.Params") +} + +func init() { proto.RegisterFile("akash/market/v1beta4/params.proto", fileDescriptor_80f1e7d9604b0c57) } + +var fileDescriptor_80f1e7d9604b0c57 = []byte{ + // 321 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0x31, 0x4f, 0xe3, 0x30, + 0x18, 0x86, 0xe3, 0x1b, 0x3a, 0xe4, 0xda, 0x3b, 0xa9, 0xea, 0x9d, 0x4a, 0x07, 0xbb, 0x64, 0xea, + 0x82, 0xad, 0x02, 0x0b, 0xb0, 0x05, 0xd6, 0x0a, 0x54, 0x36, 0x96, 0xc8, 0xae, 0xad, 0xd4, 0x2a, + 0xce, 0x17, 0xc5, 0x01, 0xca, 0x0f, 0x60, 0xe7, 0x67, 0x75, 0xec, 0xc8, 0x64, 0xa1, 0x74, 0xeb, + 0x58, 0xfe, 0x00, 0x6a, 0x92, 0xa1, 0x64, 0xb3, 0xfd, 0x3e, 0xef, 0xf3, 0x49, 0x9f, 0xfd, 0x63, + 0xbe, 0xe0, 0x76, 0xce, 0x0c, 0xcf, 0x16, 0x2a, 0x67, 0xcf, 0x63, 0xa1, 0x72, 0x7e, 0xce, 0x52, + 0x9e, 0x71, 0x63, 0x69, 0x9a, 0x41, 0x0e, 0xdd, 0x5e, 0x89, 0xd0, 0x0a, 0xa1, 0x35, 0x32, 0xe8, + 0xc5, 0x10, 0x43, 0x09, 0xb0, 0xfd, 0xa9, 0x62, 0x07, 0x78, 0x06, 0xd6, 0x80, 0x65, 0x82, 0x5b, + 0x55, 0xdb, 0xc6, 0x6c, 0x06, 0x3a, 0xa9, 0xf2, 0xe0, 0x0b, 0xf9, 0xad, 0xbb, 0x52, 0xde, 0x7d, + 0x43, 0xfe, 0x5f, 0xa1, 0x65, 0x64, 0x74, 0x12, 0x49, 0x95, 0x82, 0xd5, 0x79, 0x1f, 0x0d, 0xd1, + 0xe8, 0xf7, 0xe9, 0x11, 0xad, 0x2c, 0x74, 0x6f, 0xa9, 0x07, 0x8e, 0xe9, 0x35, 0xe8, 0x24, 0x0c, + 0x57, 0x8e, 0x78, 0x85, 0x23, 0x9d, 0x50, 0xcb, 0x89, 0x4e, 0x6e, 0xaa, 0xde, 0xd6, 0x91, 0xa6, + 0x6a, 0xe7, 0xc8, 0xff, 0x57, 0x6e, 0x1e, 0x2f, 0x83, 0x46, 0x10, 0x4c, 0x3b, 0xe2, 0xb0, 0xdb, + 0xe5, 0xfe, 0x1f, 0xc8, 0xa4, 0xca, 0x22, 0xc3, 0x97, 0x91, 0xd0, 0xd2, 0xf6, 0x7f, 0x0d, 0xd1, + 0xa8, 0x13, 0x5e, 0x15, 0x8e, 0xb4, 0x6f, 0xf7, 0xc9, 0x84, 0x2f, 0x43, 0x2d, 0xed, 0xd6, 0x91, + 0x06, 0xb9, 0x73, 0xe4, 0x5f, 0x35, 0xe4, 0xe7, 0x7b, 0x30, 0x6d, 0xc3, 0x41, 0x31, 0xbc, 0x5f, + 0x15, 0x18, 0xad, 0x0b, 0x8c, 0x3e, 0x0b, 0x8c, 0xde, 0x37, 0xd8, 0x5b, 0x6f, 0xb0, 0xf7, 0xb1, + 0xc1, 0xde, 0xc3, 0x45, 0xac, 0xf3, 0xf9, 0x93, 0xa0, 0x33, 0x30, 0xac, 0x5c, 0xf3, 0x49, 0xa2, + 0xf2, 0x17, 0xc8, 0x16, 0xf5, 0x8d, 0xa7, 0x9a, 0xc5, 0xc0, 0x12, 0x90, 0xaa, 0xf1, 0x47, 0xa2, + 0x55, 0x6e, 0xf4, 0xec, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x64, 0x8e, 0xc0, 0xcc, 0xc2, 0x01, 0x00, + 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.OrderMaxBids != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.OrderMaxBids)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.BidMinDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintParams(dAtA []byte, offset int, v uint64) int { + offset -= sovParams(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.BidMinDeposit.Size() + n += 1 + l + sovParams(uint64(l)) + if m.OrderMaxBids != 0 { + n += 1 + sovParams(uint64(m.OrderMaxBids)) + } + return n +} + +func sovParams(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozParams(x uint64) (n int) { + return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BidMinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.BidMinDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OrderMaxBids", wireType) + } + m.OrderMaxBids = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OrderMaxBids |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipParams(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowParams + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthParams + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupParams + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthParams + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") +) diff --git a/go/node/market/v1beta4/query.pb.go b/go/node/market/v1beta4/query.pb.go new file mode 100644 index 00000000..87c4eac0 --- /dev/null +++ b/go/node/market/v1beta4/query.pb.go @@ -0,0 +1,3035 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: akash/market/v1beta4/query.proto + +package v1beta4 + +import ( + context "context" + fmt "fmt" + v1beta3 "github.com/akash-network/akash-api/go/node/escrow/v1beta3" + query "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryOrdersRequest is request type for the Query/Orders RPC method +type QueryOrdersRequest struct { + Filters OrderFilters `protobuf:"bytes,1,opt,name=filters,proto3" json:"filters"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryOrdersRequest) Reset() { *m = QueryOrdersRequest{} } +func (m *QueryOrdersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOrdersRequest) ProtoMessage() {} +func (*QueryOrdersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{0} +} +func (m *QueryOrdersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOrdersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOrdersRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOrdersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOrdersRequest.Merge(m, src) +} +func (m *QueryOrdersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOrdersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOrdersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOrdersRequest proto.InternalMessageInfo + +func (m *QueryOrdersRequest) GetFilters() OrderFilters { + if m != nil { + return m.Filters + } + return OrderFilters{} +} + +func (m *QueryOrdersRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryOrdersResponse is response type for the Query/Orders RPC method +type QueryOrdersResponse struct { + Orders Orders `protobuf:"bytes,1,rep,name=orders,proto3,castrepeated=Orders" json:"orders"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryOrdersResponse) Reset() { *m = QueryOrdersResponse{} } +func (m *QueryOrdersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOrdersResponse) ProtoMessage() {} +func (*QueryOrdersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{1} +} +func (m *QueryOrdersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOrdersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOrdersResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOrdersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOrdersResponse.Merge(m, src) +} +func (m *QueryOrdersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOrdersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOrdersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOrdersResponse proto.InternalMessageInfo + +func (m *QueryOrdersResponse) GetOrders() Orders { + if m != nil { + return m.Orders + } + return nil +} + +func (m *QueryOrdersResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryOrderRequest is request type for the Query/Order RPC method +type QueryOrderRequest struct { + ID OrderID `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` +} + +func (m *QueryOrderRequest) Reset() { *m = QueryOrderRequest{} } +func (m *QueryOrderRequest) String() string { return proto.CompactTextString(m) } +func (*QueryOrderRequest) ProtoMessage() {} +func (*QueryOrderRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{2} +} +func (m *QueryOrderRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOrderRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOrderRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOrderRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOrderRequest.Merge(m, src) +} +func (m *QueryOrderRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryOrderRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOrderRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOrderRequest proto.InternalMessageInfo + +func (m *QueryOrderRequest) GetID() OrderID { + if m != nil { + return m.ID + } + return OrderID{} +} + +// QueryOrderResponse is response type for the Query/Order RPC method +type QueryOrderResponse struct { + Order Order `protobuf:"bytes,1,opt,name=order,proto3" json:"order"` +} + +func (m *QueryOrderResponse) Reset() { *m = QueryOrderResponse{} } +func (m *QueryOrderResponse) String() string { return proto.CompactTextString(m) } +func (*QueryOrderResponse) ProtoMessage() {} +func (*QueryOrderResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{3} +} +func (m *QueryOrderResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryOrderResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryOrderResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryOrderResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryOrderResponse.Merge(m, src) +} +func (m *QueryOrderResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryOrderResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryOrderResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryOrderResponse proto.InternalMessageInfo + +func (m *QueryOrderResponse) GetOrder() Order { + if m != nil { + return m.Order + } + return Order{} +} + +// QueryBidsRequest is request type for the Query/Bids RPC method +type QueryBidsRequest struct { + Filters BidFilters `protobuf:"bytes,1,opt,name=filters,proto3" json:"filters"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBidsRequest) Reset() { *m = QueryBidsRequest{} } +func (m *QueryBidsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBidsRequest) ProtoMessage() {} +func (*QueryBidsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{4} +} +func (m *QueryBidsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBidsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBidsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryBidsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBidsRequest.Merge(m, src) +} +func (m *QueryBidsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBidsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBidsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBidsRequest proto.InternalMessageInfo + +func (m *QueryBidsRequest) GetFilters() BidFilters { + if m != nil { + return m.Filters + } + return BidFilters{} +} + +func (m *QueryBidsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBidsResponse is response type for the Query/Bids RPC method +type QueryBidsResponse struct { + Bids []QueryBidResponse `protobuf:"bytes,1,rep,name=bids,proto3" json:"bids"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryBidsResponse) Reset() { *m = QueryBidsResponse{} } +func (m *QueryBidsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBidsResponse) ProtoMessage() {} +func (*QueryBidsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{5} +} +func (m *QueryBidsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBidsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBidsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryBidsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBidsResponse.Merge(m, src) +} +func (m *QueryBidsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBidsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBidsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBidsResponse proto.InternalMessageInfo + +func (m *QueryBidsResponse) GetBids() []QueryBidResponse { + if m != nil { + return m.Bids + } + return nil +} + +func (m *QueryBidsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryBidRequest is request type for the Query/Bid RPC method +type QueryBidRequest struct { + ID BidID `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` +} + +func (m *QueryBidRequest) Reset() { *m = QueryBidRequest{} } +func (m *QueryBidRequest) String() string { return proto.CompactTextString(m) } +func (*QueryBidRequest) ProtoMessage() {} +func (*QueryBidRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{6} +} +func (m *QueryBidRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBidRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBidRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryBidRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBidRequest.Merge(m, src) +} +func (m *QueryBidRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryBidRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBidRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBidRequest proto.InternalMessageInfo + +func (m *QueryBidRequest) GetID() BidID { + if m != nil { + return m.ID + } + return BidID{} +} + +// QueryBidResponse is response type for the Query/Bid RPC method +type QueryBidResponse struct { + Bid Bid `protobuf:"bytes,1,opt,name=bid,proto3" json:"bid"` + EscrowAccount v1beta3.Account `protobuf:"bytes,2,opt,name=escrow_account,json=escrowAccount,proto3" json:"escrow_account"` +} + +func (m *QueryBidResponse) Reset() { *m = QueryBidResponse{} } +func (m *QueryBidResponse) String() string { return proto.CompactTextString(m) } +func (*QueryBidResponse) ProtoMessage() {} +func (*QueryBidResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{7} +} +func (m *QueryBidResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryBidResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryBidResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryBidResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryBidResponse.Merge(m, src) +} +func (m *QueryBidResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryBidResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryBidResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryBidResponse proto.InternalMessageInfo + +func (m *QueryBidResponse) GetBid() Bid { + if m != nil { + return m.Bid + } + return Bid{} +} + +func (m *QueryBidResponse) GetEscrowAccount() v1beta3.Account { + if m != nil { + return m.EscrowAccount + } + return v1beta3.Account{} +} + +// QueryLeasesRequest is request type for the Query/Leases RPC method +type QueryLeasesRequest struct { + Filters LeaseFilters `protobuf:"bytes,1,opt,name=filters,proto3" json:"filters"` + Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryLeasesRequest) Reset() { *m = QueryLeasesRequest{} } +func (m *QueryLeasesRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLeasesRequest) ProtoMessage() {} +func (*QueryLeasesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{8} +} +func (m *QueryLeasesRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLeasesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLeasesRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLeasesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLeasesRequest.Merge(m, src) +} +func (m *QueryLeasesRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryLeasesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLeasesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLeasesRequest proto.InternalMessageInfo + +func (m *QueryLeasesRequest) GetFilters() LeaseFilters { + if m != nil { + return m.Filters + } + return LeaseFilters{} +} + +func (m *QueryLeasesRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryLeasesResponse is response type for the Query/Leases RPC method +type QueryLeasesResponse struct { + Leases []QueryLeaseResponse `protobuf:"bytes,1,rep,name=leases,proto3" json:"leases"` + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryLeasesResponse) Reset() { *m = QueryLeasesResponse{} } +func (m *QueryLeasesResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLeasesResponse) ProtoMessage() {} +func (*QueryLeasesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{9} +} +func (m *QueryLeasesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLeasesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLeasesResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLeasesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLeasesResponse.Merge(m, src) +} +func (m *QueryLeasesResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLeasesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLeasesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLeasesResponse proto.InternalMessageInfo + +func (m *QueryLeasesResponse) GetLeases() []QueryLeaseResponse { + if m != nil { + return m.Leases + } + return nil +} + +func (m *QueryLeasesResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryLeaseRequest is request type for the Query/Lease RPC method +type QueryLeaseRequest struct { + ID LeaseID `protobuf:"bytes,1,opt,name=id,proto3" json:"id"` +} + +func (m *QueryLeaseRequest) Reset() { *m = QueryLeaseRequest{} } +func (m *QueryLeaseRequest) String() string { return proto.CompactTextString(m) } +func (*QueryLeaseRequest) ProtoMessage() {} +func (*QueryLeaseRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{10} +} +func (m *QueryLeaseRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLeaseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLeaseRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLeaseRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLeaseRequest.Merge(m, src) +} +func (m *QueryLeaseRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryLeaseRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLeaseRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLeaseRequest proto.InternalMessageInfo + +func (m *QueryLeaseRequest) GetID() LeaseID { + if m != nil { + return m.ID + } + return LeaseID{} +} + +// QueryLeaseResponse is response type for the Query/Lease RPC method +type QueryLeaseResponse struct { + Lease Lease `protobuf:"bytes,1,opt,name=lease,proto3" json:"lease"` + EscrowPayment v1beta3.FractionalPayment `protobuf:"bytes,2,opt,name=escrow_payment,json=escrowPayment,proto3" json:"escrow_payment"` +} + +func (m *QueryLeaseResponse) Reset() { *m = QueryLeaseResponse{} } +func (m *QueryLeaseResponse) String() string { return proto.CompactTextString(m) } +func (*QueryLeaseResponse) ProtoMessage() {} +func (*QueryLeaseResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_18494cd3f4a720d6, []int{11} +} +func (m *QueryLeaseResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryLeaseResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryLeaseResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryLeaseResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryLeaseResponse.Merge(m, src) +} +func (m *QueryLeaseResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryLeaseResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryLeaseResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryLeaseResponse proto.InternalMessageInfo + +func (m *QueryLeaseResponse) GetLease() Lease { + if m != nil { + return m.Lease + } + return Lease{} +} + +func (m *QueryLeaseResponse) GetEscrowPayment() v1beta3.FractionalPayment { + if m != nil { + return m.EscrowPayment + } + return v1beta3.FractionalPayment{} +} + +func init() { + proto.RegisterType((*QueryOrdersRequest)(nil), "akash.market.v1beta4.QueryOrdersRequest") + proto.RegisterType((*QueryOrdersResponse)(nil), "akash.market.v1beta4.QueryOrdersResponse") + proto.RegisterType((*QueryOrderRequest)(nil), "akash.market.v1beta4.QueryOrderRequest") + proto.RegisterType((*QueryOrderResponse)(nil), "akash.market.v1beta4.QueryOrderResponse") + proto.RegisterType((*QueryBidsRequest)(nil), "akash.market.v1beta4.QueryBidsRequest") + proto.RegisterType((*QueryBidsResponse)(nil), "akash.market.v1beta4.QueryBidsResponse") + proto.RegisterType((*QueryBidRequest)(nil), "akash.market.v1beta4.QueryBidRequest") + proto.RegisterType((*QueryBidResponse)(nil), "akash.market.v1beta4.QueryBidResponse") + proto.RegisterType((*QueryLeasesRequest)(nil), "akash.market.v1beta4.QueryLeasesRequest") + proto.RegisterType((*QueryLeasesResponse)(nil), "akash.market.v1beta4.QueryLeasesResponse") + proto.RegisterType((*QueryLeaseRequest)(nil), "akash.market.v1beta4.QueryLeaseRequest") + proto.RegisterType((*QueryLeaseResponse)(nil), "akash.market.v1beta4.QueryLeaseResponse") +} + +func init() { proto.RegisterFile("akash/market/v1beta4/query.proto", fileDescriptor_18494cd3f4a720d6) } + +var fileDescriptor_18494cd3f4a720d6 = []byte{ + // 803 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcf, 0x4f, 0x13, 0x4d, + 0x18, 0xee, 0x16, 0xe8, 0x97, 0x0c, 0xf9, 0xf8, 0xbe, 0x6f, 0x3e, 0x0e, 0x58, 0xb4, 0x85, 0x1a, + 0x69, 0x31, 0x71, 0x37, 0x80, 0x09, 0xe1, 0x86, 0x2b, 0xa9, 0x81, 0xf8, 0x03, 0xab, 0x27, 0x2f, + 0x66, 0xda, 0x1d, 0x96, 0x09, 0xed, 0x4e, 0xd9, 0xd9, 0x4a, 0x38, 0x98, 0x18, 0x13, 0x13, 0x8f, + 0x1a, 0xaf, 0xc6, 0x98, 0x90, 0x78, 0xf0, 0xe2, 0xbf, 0xc1, 0x91, 0xc4, 0x8b, 0x27, 0x34, 0xc5, + 0x3f, 0xc4, 0xcc, 0xcc, 0xbb, 0xfd, 0x95, 0xed, 0x6e, 0x49, 0xe0, 0x06, 0xdd, 0xe7, 0x7d, 0xe7, + 0x79, 0x9f, 0xf7, 0x99, 0x67, 0x17, 0xcd, 0x91, 0x3d, 0x22, 0x76, 0xad, 0x06, 0xf1, 0xf7, 0x68, + 0x60, 0xbd, 0x58, 0xaa, 0xd2, 0x80, 0xdc, 0xb6, 0xf6, 0x5b, 0xd4, 0x3f, 0x34, 0x9b, 0x3e, 0x0f, + 0x38, 0x9e, 0x56, 0x08, 0x53, 0x23, 0x4c, 0x40, 0x64, 0xa7, 0x5d, 0xee, 0x72, 0x05, 0xb0, 0xe4, + 0x5f, 0x1a, 0x9b, 0xbd, 0xea, 0x72, 0xee, 0xd6, 0xa9, 0x45, 0x9a, 0xcc, 0x22, 0x9e, 0xc7, 0x03, + 0x12, 0x30, 0xee, 0x09, 0x78, 0x7a, 0xb3, 0xc6, 0x45, 0x83, 0x0b, 0xab, 0x4a, 0x04, 0xd5, 0x47, + 0xc0, 0x81, 0x4b, 0x56, 0x93, 0xb8, 0xcc, 0x53, 0x60, 0xc0, 0x02, 0x2f, 0x2a, 0x6a, 0x3e, 0x3f, + 0x00, 0xd8, 0x8a, 0x15, 0x1c, 0x36, 0xa9, 0xe8, 0x47, 0x0c, 0x30, 0xe7, 0xbe, 0x43, 0x7d, 0x40, + 0xe4, 0x22, 0x11, 0x55, 0xe6, 0xc4, 0x76, 0xa8, 0x53, 0x22, 0xa8, 0x46, 0x14, 0x3e, 0x1b, 0x08, + 0x3f, 0x96, 0x44, 0x1f, 0xc9, 0xb6, 0xa2, 0x42, 0xf7, 0x5b, 0x54, 0x04, 0xd8, 0x46, 0x7f, 0xed, + 0xb0, 0x7a, 0x40, 0x7d, 0x31, 0x63, 0xcc, 0x19, 0xa5, 0xc9, 0xe5, 0x82, 0x19, 0x25, 0x92, 0xa9, + 0xaa, 0xca, 0x1a, 0x69, 0x8f, 0x1f, 0x9f, 0xe6, 0x53, 0x95, 0xb0, 0x10, 0x97, 0x11, 0xea, 0x0e, + 0x3d, 0x93, 0x56, 0x6d, 0x16, 0x4c, 0xad, 0x90, 0x29, 0x15, 0x32, 0xf5, 0x12, 0x40, 0x21, 0x73, + 0x9b, 0xb8, 0x14, 0xce, 0xaf, 0xf4, 0x54, 0x16, 0x8e, 0x0c, 0xf4, 0x7f, 0x1f, 0x45, 0xd1, 0xe4, + 0x9e, 0xa0, 0xf8, 0x2e, 0xca, 0x28, 0x2d, 0x24, 0xc5, 0xb1, 0xd2, 0xe4, 0xf2, 0x6c, 0x0c, 0x45, + 0x7b, 0x4a, 0x72, 0xfb, 0xfa, 0x33, 0x9f, 0x81, 0x26, 0x50, 0x8a, 0xef, 0x45, 0x90, 0x2c, 0x26, + 0x92, 0xd4, 0x0c, 0xfa, 0x58, 0x3e, 0x44, 0xff, 0x75, 0x49, 0x86, 0x32, 0xae, 0xa1, 0x34, 0x73, + 0x40, 0xc1, 0x6b, 0x31, 0xf4, 0x36, 0x37, 0x6c, 0x24, 0x09, 0xb6, 0x4f, 0xf3, 0xe9, 0xcd, 0x8d, + 0x4a, 0x9a, 0x39, 0x85, 0x07, 0xbd, 0x7b, 0xe9, 0xcc, 0xbc, 0x8a, 0x26, 0x14, 0x71, 0xe8, 0x19, + 0x3b, 0xb2, 0x5e, 0x87, 0xc6, 0x17, 0x3e, 0x1a, 0xe8, 0x5f, 0xd5, 0xcf, 0x66, 0x4e, 0x67, 0xcb, + 0xeb, 0x83, 0x5b, 0x9e, 0x8b, 0xee, 0x67, 0x33, 0xe7, 0x92, 0x77, 0xfc, 0xc9, 0x00, 0xf9, 0x34, + 0x3d, 0x98, 0x76, 0x1d, 0x8d, 0x57, 0x99, 0x13, 0xee, 0x77, 0x21, 0x9a, 0x5c, 0x58, 0x16, 0x56, + 0x01, 0x45, 0x55, 0x79, 0x71, 0xeb, 0xdd, 0x42, 0xff, 0x74, 0x0f, 0xd2, 0xea, 0xad, 0xf6, 0x2c, + 0x77, 0x76, 0xa8, 0x70, 0x11, 0xab, 0x7d, 0xdf, 0xb3, 0x8b, 0xce, 0xac, 0x4b, 0x68, 0xac, 0xda, + 0x69, 0x77, 0x65, 0x68, 0x3b, 0x98, 0x4e, 0x62, 0xf1, 0x16, 0x9a, 0xd2, 0xe9, 0xf1, 0x9c, 0xd4, + 0x6a, 0xbc, 0xe5, 0x05, 0x30, 0x60, 0xe8, 0x34, 0xfd, 0x10, 0xaa, 0x57, 0xcc, 0x3b, 0x1a, 0x04, + 0x1d, 0xfe, 0xd6, 0x4f, 0xe1, 0xc7, 0x6e, 0x0e, 0xdc, 0x97, 0xe1, 0x70, 0xee, 0x1c, 0x50, 0x55, + 0x97, 0xec, 0x91, 0x2f, 0x61, 0x0e, 0x84, 0x14, 0x41, 0xb9, 0x32, 0xca, 0xa8, 0x44, 0x0b, 0x7d, + 0x52, 0x8a, 0xf1, 0x89, 0x2a, 0x1d, 0x70, 0x0a, 0x54, 0x5f, 0x7c, 0x14, 0xc0, 0x61, 0x23, 0x47, + 0x81, 0xc2, 0x47, 0xf8, 0xe5, 0xa8, 0x6f, 0x37, 0xbd, 0x59, 0xa0, 0x98, 0xc7, 0x5b, 0x50, 0xd5, + 0x84, 0x59, 0xa0, 0xf0, 0xf8, 0x69, 0xc7, 0x37, 0x4d, 0x72, 0xd8, 0xa0, 0x1d, 0xdf, 0x14, 0xa3, + 0x7d, 0x53, 0xf6, 0x49, 0x4d, 0xce, 0x45, 0xea, 0xdb, 0x1a, 0xde, 0xef, 0x20, 0xf8, 0x71, 0xf9, + 0x5b, 0x06, 0x4d, 0x28, 0x96, 0xf8, 0xad, 0x81, 0x20, 0x66, 0x71, 0xdc, 0x2e, 0xfa, 0xde, 0x38, + 0xd9, 0xc5, 0x11, 0x90, 0x7a, 0xf0, 0xc2, 0xe2, 0xeb, 0xef, 0xbf, 0x3f, 0xa4, 0xaf, 0xe3, 0x79, + 0x6b, 0xf8, 0x0b, 0x52, 0x58, 0x75, 0x26, 0x02, 0xfc, 0xc6, 0x40, 0x13, 0xaa, 0x1a, 0x17, 0x93, + 0xfa, 0x87, 0x44, 0x4a, 0xc9, 0xc0, 0x73, 0xf1, 0x60, 0xde, 0x0e, 0xc7, 0xaf, 0x0c, 0x34, 0x2e, + 0xa3, 0x0d, 0x27, 0x84, 0x58, 0x47, 0x8e, 0x62, 0x22, 0x0e, 0x48, 0x14, 0x15, 0x89, 0x79, 0x9c, + 0xb7, 0x86, 0x7d, 0x0b, 0x80, 0x14, 0x2f, 0xd1, 0x98, 0xcd, 0x1c, 0x7c, 0x23, 0x29, 0x45, 0xf5, + 0xf9, 0x23, 0x86, 0xed, 0x48, 0xc7, 0x2b, 0x05, 0xa4, 0x29, 0xf4, 0xc5, 0xc5, 0x89, 0x17, 0x74, + 0x24, 0x53, 0xf4, 0xa7, 0x40, 0xd2, 0x32, 0xf4, 0x1d, 0xef, 0x9a, 0x42, 0x55, 0xc7, 0x9a, 0xa2, + 0xf7, 0xf6, 0x66, 0x47, 0xce, 0x94, 0x11, 0x79, 0x48, 0x49, 0xec, 0x27, 0xc7, 0xed, 0x9c, 0x71, + 0xd2, 0xce, 0x19, 0xbf, 0xda, 0x39, 0xe3, 0xdd, 0x59, 0x2e, 0x75, 0x72, 0x96, 0x4b, 0xfd, 0x38, + 0xcb, 0xa5, 0x9e, 0xad, 0xb9, 0x2c, 0xd8, 0x6d, 0x55, 0xcd, 0x1a, 0x6f, 0xe8, 0x36, 0xb7, 0x3c, + 0x1a, 0x1c, 0x70, 0x7f, 0x0f, 0xfe, 0x93, 0x5f, 0x9f, 0x2e, 0xb7, 0x3c, 0xee, 0xd0, 0x81, 0x03, + 0xaa, 0x19, 0xf5, 0x5d, 0xb7, 0xf2, 0x27, 0x00, 0x00, 0xff, 0xff, 0x2f, 0x13, 0x08, 0x1a, 0xf7, + 0x0a, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Orders queries orders with filters + Orders(ctx context.Context, in *QueryOrdersRequest, opts ...grpc.CallOption) (*QueryOrdersResponse, error) + // Order queries order details + Order(ctx context.Context, in *QueryOrderRequest, opts ...grpc.CallOption) (*QueryOrderResponse, error) + // Bids queries bids with filters + Bids(ctx context.Context, in *QueryBidsRequest, opts ...grpc.CallOption) (*QueryBidsResponse, error) + // Bid queries bid details + Bid(ctx context.Context, in *QueryBidRequest, opts ...grpc.CallOption) (*QueryBidResponse, error) + // Leases queries leases with filters + Leases(ctx context.Context, in *QueryLeasesRequest, opts ...grpc.CallOption) (*QueryLeasesResponse, error) + // Lease queries lease details + Lease(ctx context.Context, in *QueryLeaseRequest, opts ...grpc.CallOption) (*QueryLeaseResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Orders(ctx context.Context, in *QueryOrdersRequest, opts ...grpc.CallOption) (*QueryOrdersResponse, error) { + out := new(QueryOrdersResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Query/Orders", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Order(ctx context.Context, in *QueryOrderRequest, opts ...grpc.CallOption) (*QueryOrderResponse, error) { + out := new(QueryOrderResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Query/Order", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Bids(ctx context.Context, in *QueryBidsRequest, opts ...grpc.CallOption) (*QueryBidsResponse, error) { + out := new(QueryBidsResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Query/Bids", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Bid(ctx context.Context, in *QueryBidRequest, opts ...grpc.CallOption) (*QueryBidResponse, error) { + out := new(QueryBidResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Query/Bid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Leases(ctx context.Context, in *QueryLeasesRequest, opts ...grpc.CallOption) (*QueryLeasesResponse, error) { + out := new(QueryLeasesResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Query/Leases", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) Lease(ctx context.Context, in *QueryLeaseRequest, opts ...grpc.CallOption) (*QueryLeaseResponse, error) { + out := new(QueryLeaseResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Query/Lease", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Orders queries orders with filters + Orders(context.Context, *QueryOrdersRequest) (*QueryOrdersResponse, error) + // Order queries order details + Order(context.Context, *QueryOrderRequest) (*QueryOrderResponse, error) + // Bids queries bids with filters + Bids(context.Context, *QueryBidsRequest) (*QueryBidsResponse, error) + // Bid queries bid details + Bid(context.Context, *QueryBidRequest) (*QueryBidResponse, error) + // Leases queries leases with filters + Leases(context.Context, *QueryLeasesRequest) (*QueryLeasesResponse, error) + // Lease queries lease details + Lease(context.Context, *QueryLeaseRequest) (*QueryLeaseResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Orders(ctx context.Context, req *QueryOrdersRequest) (*QueryOrdersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Orders not implemented") +} +func (*UnimplementedQueryServer) Order(ctx context.Context, req *QueryOrderRequest) (*QueryOrderResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Order not implemented") +} +func (*UnimplementedQueryServer) Bids(ctx context.Context, req *QueryBidsRequest) (*QueryBidsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Bids not implemented") +} +func (*UnimplementedQueryServer) Bid(ctx context.Context, req *QueryBidRequest) (*QueryBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Bid not implemented") +} +func (*UnimplementedQueryServer) Leases(ctx context.Context, req *QueryLeasesRequest) (*QueryLeasesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Leases not implemented") +} +func (*UnimplementedQueryServer) Lease(ctx context.Context, req *QueryLeaseRequest) (*QueryLeaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Lease not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Orders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOrdersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Orders(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Query/Orders", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Orders(ctx, req.(*QueryOrdersRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Order_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryOrderRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Order(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Query/Order", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Order(ctx, req.(*QueryOrderRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Bids_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBidsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Bids(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Query/Bids", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Bids(ctx, req.(*QueryBidsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Bid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryBidRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Bid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Query/Bid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Bid(ctx, req.(*QueryBidRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Leases_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLeasesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Leases(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Query/Leases", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Leases(ctx, req.(*QueryLeasesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Lease_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryLeaseRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Lease(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Query/Lease", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Lease(ctx, req.(*QueryLeaseRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "akash.market.v1beta4.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Orders", + Handler: _Query_Orders_Handler, + }, + { + MethodName: "Order", + Handler: _Query_Order_Handler, + }, + { + MethodName: "Bids", + Handler: _Query_Bids_Handler, + }, + { + MethodName: "Bid", + Handler: _Query_Bid_Handler, + }, + { + MethodName: "Leases", + Handler: _Query_Leases_Handler, + }, + { + MethodName: "Lease", + Handler: _Query_Lease_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "akash/market/v1beta4/query.proto", +} + +func (m *QueryOrdersRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOrdersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOrdersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Filters.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryOrdersResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOrdersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOrdersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Orders) > 0 { + for iNdEx := len(m.Orders) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Orders[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryOrderRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOrderRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOrderRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryOrderResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryOrderResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryOrderResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Order.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryBidsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBidsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBidsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Filters.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryBidsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBidsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBidsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + 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 = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryBidRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBidRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBidRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryBidResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryBidResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.EscrowAccount.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Bid.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryLeasesRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryLeasesRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLeasesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Filters.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryLeasesResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryLeasesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLeasesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.Leases) > 0 { + for iNdEx := len(m.Leases) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Leases[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *QueryLeaseRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryLeaseRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLeaseRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ID.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *QueryLeaseResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryLeaseResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryLeaseResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.EscrowPayment.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + { + size, err := m.Lease.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryOrdersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Filters.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOrdersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Orders) > 0 { + for _, e := range m.Orders { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryOrderRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ID.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryOrderResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Order.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryBidsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Filters.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBidsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Bids) > 0 { + for _, e := range m.Bids { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryBidRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ID.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryBidResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Bid.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.EscrowAccount.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryLeasesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Filters.Size() + n += 1 + l + sovQuery(uint64(l)) + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLeasesResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Leases) > 0 { + for _, e := range m.Leases { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryLeaseRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ID.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *QueryLeaseResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Lease.Size() + n += 1 + l + sovQuery(uint64(l)) + l = m.EscrowPayment.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryOrdersRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOrdersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOrdersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Filters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOrdersResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOrdersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOrdersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Orders", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Orders = append(m.Orders, Order{}) + if err := m.Orders[len(m.Orders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOrderRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOrderRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOrderRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryOrderResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryOrderResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryOrderResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Order", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Order.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBidsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBidsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBidsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Filters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBidsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBidsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBidsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bids", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Bids = append(m.Bids, QueryBidResponse{}) + if err := m.Bids[len(m.Bids)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBidRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBidRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBidRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryBidResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryBidResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryBidResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bid", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Bid.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EscrowAccount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.EscrowAccount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLeasesRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLeasesRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLeasesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Filters", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Filters.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLeasesResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLeasesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLeasesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Leases", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Leases = append(m.Leases, QueryLeaseResponse{}) + if err := m.Leases[len(m.Leases)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLeaseRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLeaseRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLeaseRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryLeaseResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryLeaseResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryLeaseResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Lease.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EscrowPayment", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.EscrowPayment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/go/node/market/v1beta4/query.pb.gw.go b/go/node/market/v1beta4/query.pb.gw.go new file mode 100644 index 00000000..ee29aa23 --- /dev/null +++ b/go/node/market/v1beta4/query.pb.gw.go @@ -0,0 +1,586 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: akash/market/v1beta4/query.proto + +/* +Package v1beta4 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package v1beta4 + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +var ( + filter_Query_Orders_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Orders_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOrdersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Orders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Orders(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Orders_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOrdersRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Orders_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Orders(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Order_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Order_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOrderRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Order_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Order(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Order_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryOrderRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Order_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Order(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Bids_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Bids_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBidsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bids_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Bids(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Bids_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBidsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bids_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Bids(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Bid_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Bid_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBidRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bid_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Bid(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Bid_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryBidRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Bid_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Bid(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Leases_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Leases_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLeasesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Leases_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Leases(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Leases_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLeasesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Leases_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Leases(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Query_Lease_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Lease_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLeaseRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Lease_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Lease(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Lease_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryLeaseRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Lease_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Lease(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Orders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Orders_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Orders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Order_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Order_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Order_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Bids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Bids_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Bids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Bid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Bid_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Bid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Leases_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Leases_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Leases_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Lease_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Lease_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Lease_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Orders_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Orders_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Orders_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Order_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Order_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Order_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Bids_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Bids_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Bids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Bid_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Bid_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Bid_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Leases_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Leases_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Leases_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Lease_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Lease_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Lease_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Orders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"akash", "market", "v1beta4", "orders", "list"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Order_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"akash", "market", "v1beta4", "orders", "info"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Bids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"akash", "market", "v1beta4", "bids", "list"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Bid_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"akash", "market", "v1beta4", "bids", "info"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Leases_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"akash", "market", "v1beta4", "leases", "list"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_Lease_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"akash", "market", "v1beta4", "leases", "info"}, "", runtime.AssumeColonVerbOpt(true))) +) + +var ( + forward_Query_Orders_0 = runtime.ForwardResponseMessage + + forward_Query_Order_0 = runtime.ForwardResponseMessage + + forward_Query_Bids_0 = runtime.ForwardResponseMessage + + forward_Query_Bid_0 = runtime.ForwardResponseMessage + + forward_Query_Leases_0 = runtime.ForwardResponseMessage + + forward_Query_Lease_0 = runtime.ForwardResponseMessage +) diff --git a/go/node/market/v1beta4/service.pb.go b/go/node/market/v1beta4/service.pb.go new file mode 100644 index 00000000..f9273b07 --- /dev/null +++ b/go/node/market/v1beta4/service.pb.go @@ -0,0 +1,287 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: akash/market/v1beta4/service.proto + +package v1beta4 + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { + proto.RegisterFile("akash/market/v1beta4/service.proto", fileDescriptor_3f002bb22b8d66bc) +} + +var fileDescriptor_3f002bb22b8d66bc = []byte{ + // 292 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0xcc, 0x4e, 0x2c, + 0xce, 0xd0, 0xcf, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, + 0xd1, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, + 0x01, 0xab, 0xd1, 0x83, 0xa8, 0xd1, 0x83, 0xaa, 0x91, 0x92, 0xc3, 0xaa, 0x33, 0x29, 0x33, 0x05, + 0xa2, 0x4b, 0x4a, 0x01, 0xab, 0x7c, 0x4e, 0x6a, 0x62, 0x31, 0xd4, 0x5c, 0xa3, 0x17, 0xcc, 0x5c, + 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0xd1, 0x5c, 0x9c, 0xce, 0x45, 0xa9, 0x89, 0x25, 0xa9, 0x4e, 0x99, + 0x29, 0x42, 0x4a, 0x7a, 0xd8, 0x6c, 0xd3, 0xf3, 0x2d, 0x4e, 0x87, 0xab, 0x91, 0xd2, 0x22, 0xac, + 0x26, 0x28, 0xb5, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, 0x28, 0x82, 0x8b, 0xc3, 0x39, 0x27, 0xbf, + 0x18, 0x6c, 0xb6, 0x22, 0x6e, 0x7d, 0x50, 0x25, 0x52, 0x9a, 0x04, 0x95, 0xc0, 0x4d, 0x4e, 0xe7, + 0xe2, 0x0d, 0xcf, 0x2c, 0xc9, 0x48, 0x29, 0x4a, 0x2c, 0xf7, 0x01, 0xf9, 0x4a, 0x48, 0x0d, 0xa7, + 0x5e, 0x14, 0x75, 0x52, 0x7a, 0xc4, 0xa9, 0x83, 0x5b, 0x94, 0xc8, 0xc5, 0x0d, 0xf1, 0x17, 0xc4, + 0x1a, 0x15, 0x02, 0xbe, 0x87, 0x58, 0xa2, 0x43, 0x8c, 0x2a, 0xb8, 0x15, 0x71, 0x5c, 0x5c, 0x60, + 0xff, 0x41, 0x6c, 0x50, 0xc6, 0x1f, 0x08, 0x10, 0x0b, 0xb4, 0x89, 0x50, 0x04, 0x33, 0xdf, 0x29, + 0xf8, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, + 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x2c, 0xd3, 0x33, 0x4b, 0x32, + 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xc1, 0x06, 0xea, 0xe6, 0xa5, 0x96, 0x94, 0xe7, 0x17, + 0x65, 0x43, 0x79, 0x89, 0x05, 0x99, 0xfa, 0xe9, 0xf9, 0xfa, 0x79, 0xf9, 0x29, 0xa9, 0x68, 0x69, + 0x29, 0x89, 0x0d, 0x9c, 0x8c, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5a, 0x33, 0xac, 0x52, + 0xc4, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // CreateBid defines a method to create a bid given proper inputs. + CreateBid(ctx context.Context, in *MsgCreateBid, opts ...grpc.CallOption) (*MsgCreateBidResponse, error) + // CloseBid defines a method to close a bid given proper inputs. + CloseBid(ctx context.Context, in *MsgCloseBid, opts ...grpc.CallOption) (*MsgCloseBidResponse, error) + // WithdrawLease withdraws accrued funds from the lease payment + WithdrawLease(ctx context.Context, in *MsgWithdrawLease, opts ...grpc.CallOption) (*MsgWithdrawLeaseResponse, error) + // CreateLease creates a new lease + CreateLease(ctx context.Context, in *MsgCreateLease, opts ...grpc.CallOption) (*MsgCreateLeaseResponse, error) + // CloseLease defines a method to close an order given proper inputs. + CloseLease(ctx context.Context, in *MsgCloseLease, opts ...grpc.CallOption) (*MsgCloseLeaseResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateBid(ctx context.Context, in *MsgCreateBid, opts ...grpc.CallOption) (*MsgCreateBidResponse, error) { + out := new(MsgCreateBidResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Msg/CreateBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CloseBid(ctx context.Context, in *MsgCloseBid, opts ...grpc.CallOption) (*MsgCloseBidResponse, error) { + out := new(MsgCloseBidResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Msg/CloseBid", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) WithdrawLease(ctx context.Context, in *MsgWithdrawLease, opts ...grpc.CallOption) (*MsgWithdrawLeaseResponse, error) { + out := new(MsgWithdrawLeaseResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Msg/WithdrawLease", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CreateLease(ctx context.Context, in *MsgCreateLease, opts ...grpc.CallOption) (*MsgCreateLeaseResponse, error) { + out := new(MsgCreateLeaseResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Msg/CreateLease", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) CloseLease(ctx context.Context, in *MsgCloseLease, opts ...grpc.CallOption) (*MsgCloseLeaseResponse, error) { + out := new(MsgCloseLeaseResponse) + err := c.cc.Invoke(ctx, "/akash.market.v1beta4.Msg/CloseLease", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateBid defines a method to create a bid given proper inputs. + CreateBid(context.Context, *MsgCreateBid) (*MsgCreateBidResponse, error) + // CloseBid defines a method to close a bid given proper inputs. + CloseBid(context.Context, *MsgCloseBid) (*MsgCloseBidResponse, error) + // WithdrawLease withdraws accrued funds from the lease payment + WithdrawLease(context.Context, *MsgWithdrawLease) (*MsgWithdrawLeaseResponse, error) + // CreateLease creates a new lease + CreateLease(context.Context, *MsgCreateLease) (*MsgCreateLeaseResponse, error) + // CloseLease defines a method to close an order given proper inputs. + CloseLease(context.Context, *MsgCloseLease) (*MsgCloseLeaseResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateBid(ctx context.Context, req *MsgCreateBid) (*MsgCreateBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateBid not implemented") +} +func (*UnimplementedMsgServer) CloseBid(ctx context.Context, req *MsgCloseBid) (*MsgCloseBidResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseBid not implemented") +} +func (*UnimplementedMsgServer) WithdrawLease(ctx context.Context, req *MsgWithdrawLease) (*MsgWithdrawLeaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method WithdrawLease not implemented") +} +func (*UnimplementedMsgServer) CreateLease(ctx context.Context, req *MsgCreateLease) (*MsgCreateLeaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateLease not implemented") +} +func (*UnimplementedMsgServer) CloseLease(ctx context.Context, req *MsgCloseLease) (*MsgCloseLeaseResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CloseLease not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Msg/CreateBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateBid(ctx, req.(*MsgCreateBid)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CloseBid_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCloseBid) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CloseBid(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Msg/CloseBid", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CloseBid(ctx, req.(*MsgCloseBid)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_WithdrawLease_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgWithdrawLease) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).WithdrawLease(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Msg/WithdrawLease", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).WithdrawLease(ctx, req.(*MsgWithdrawLease)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CreateLease_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateLease) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateLease(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Msg/CreateLease", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateLease(ctx, req.(*MsgCreateLease)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_CloseLease_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCloseLease) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CloseLease(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/akash.market.v1beta4.Msg/CloseLease", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CloseLease(ctx, req.(*MsgCloseLease)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "akash.market.v1beta4.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateBid", + Handler: _Msg_CreateBid_Handler, + }, + { + MethodName: "CloseBid", + Handler: _Msg_CloseBid_Handler, + }, + { + MethodName: "WithdrawLease", + Handler: _Msg_WithdrawLease_Handler, + }, + { + MethodName: "CreateLease", + Handler: _Msg_CreateLease_Handler, + }, + { + MethodName: "CloseLease", + Handler: _Msg_CloseLease_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "akash/market/v1beta4/service.proto", +} diff --git a/go/node/market/v1beta4/types.go b/go/node/market/v1beta4/types.go new file mode 100644 index 00000000..9aa87d68 --- /dev/null +++ b/go/node/market/v1beta4/types.go @@ -0,0 +1,245 @@ +package v1beta4 + +import ( + "strings" + + sdk "github.com/cosmos/cosmos-sdk/types" + + types "github.com/akash-network/akash-api/go/node/types/v1beta3" + + atypes "github.com/akash-network/akash-api/go/node/audit/v1beta3" + + "gopkg.in/yaml.v3" +) + +const ( + APIVersion = "v1beta4" +) + +// ID method returns OrderID details of specific order +func (o Order) ID() OrderID { + return o.OrderID +} + +// String implements the Stringer interface for a Order object. +func (o Order) String() string { + out, _ := yaml.Marshal(o) + return string(out) +} + +// Orders is a collection of Order +type Orders []Order + +// String implements the Stringer interface for a Orders object. +func (o Orders) String() string { + var out string + for _, order := range o { + out += order.String() + "\n" + } + + return strings.TrimSpace(out) +} + +// ValidateCanBid method validates whether order is open or not and +// returns error if not +func (o Order) ValidateCanBid() error { + switch o.State { + case OrderOpen: + return nil + case OrderActive: + return ErrOrderActive + default: + return ErrOrderClosed + } +} + +// ValidateInactive method validates whether order is open or not and +// returns error if not +func (o Order) ValidateInactive() error { + switch o.State { + case OrderClosed: + return nil + case OrderActive: + return ErrOrderActive + default: + return ErrOrderClosed + } +} + +// Price method returns price of specific order +func (o Order) Price() sdk.DecCoin { + return o.Spec.Price() +} + +// MatchAttributes method compares provided attributes with specific order attributes +func (o Order) MatchAttributes(attrs []types.Attribute) bool { + return o.Spec.MatchAttributes(attrs) +} + +// MatchRequirements method compares provided attributes with specific order attributes +func (o Order) MatchRequirements(prov []atypes.Provider) bool { + return o.Spec.MatchRequirements(prov) +} + +// MatchResourcesRequirements method compares provider capabilities with specific order resources attributes +func (o Order) MatchResourcesRequirements(attr types.Attributes) bool { + return o.Spec.MatchResourcesRequirements(attr) +} + +// Accept returns whether order filters valid or not +func (filters OrderFilters) Accept(obj Order, stateVal Order_State) bool { + // Checking owner filter + if filters.Owner != "" && filters.Owner != obj.OrderID.Owner { + return false + } + + // Checking dseq filter + if filters.DSeq != 0 && filters.DSeq != obj.OrderID.DSeq { + return false + } + + // Checking gseq filter + if filters.GSeq != 0 && filters.GSeq != obj.OrderID.GSeq { + return false + } + + // Checking oseq filter + if filters.OSeq != 0 && filters.OSeq != obj.OrderID.OSeq { + return false + } + + // Checking state filter + if stateVal != 0 && stateVal != obj.State { + return false + } + + return true +} + +// ID method returns BidID details of specific bid +func (obj Bid) ID() BidID { + return obj.BidID +} + +// String implements the Stringer interface for a Bid object. +func (obj Bid) String() string { + out, _ := yaml.Marshal(obj) + return string(out) +} + +// Bids is a collection of Bid +type Bids []Bid + +// String implements the Stringer interface for a Bids object. +func (b Bids) String() string { + var out string + for _, bid := range b { + out += bid.String() + "\n" + } + + return strings.TrimSpace(out) +} + +// Accept returns whether bid filters valid or not +func (filters BidFilters) Accept(obj Bid, stateVal Bid_State) bool { + // Checking owner filter + if filters.Owner != "" && filters.Owner != obj.BidID.Owner { + return false + } + + // Checking dseq filter + if filters.DSeq != 0 && filters.DSeq != obj.BidID.DSeq { + return false + } + + // Checking gseq filter + if filters.GSeq != 0 && filters.GSeq != obj.BidID.GSeq { + return false + } + + // Checking oseq filter + if filters.OSeq != 0 && filters.OSeq != obj.BidID.OSeq { + return false + } + + // Checking provider filter + if filters.Provider != "" && filters.Provider != obj.BidID.Provider { + return false + } + + // Checking state filter + if stateVal != 0 && stateVal != obj.State { + return false + } + + return true +} + +// ID method returns LeaseID details of specific lease +func (obj Lease) ID() LeaseID { + return obj.LeaseID +} + +// String implements the Stringer interface for a Lease object. +func (obj Lease) String() string { + out, _ := yaml.Marshal(obj) + return string(out) +} + +// Leases is a collection of Lease +type Leases []Lease + +// String implements the Stringer interface for a Leases object. +func (l Leases) String() string { + var out string + for _, order := range l { + out += order.String() + "\n" + } + + return strings.TrimSpace(out) +} + +// Accept returns whether lease filters valid or not +func (filters LeaseFilters) Accept(obj Lease, stateVal Lease_State) bool { + // Checking owner filter + if filters.Owner != "" && filters.Owner != obj.LeaseID.Owner { + return false + } + + // Checking dseq filter + if filters.DSeq != 0 && filters.DSeq != obj.LeaseID.DSeq { + return false + } + + // Checking gseq filter + if filters.GSeq != 0 && filters.GSeq != obj.LeaseID.GSeq { + return false + } + + // Checking oseq filter + if filters.OSeq != 0 && filters.OSeq != obj.LeaseID.OSeq { + return false + } + + // Checking provider filter + if filters.Provider != "" && filters.Provider != obj.LeaseID.Provider { + return false + } + + // Checking state filter + if stateVal != 0 && stateVal != obj.State { + return false + } + + return true +} + +func (m QueryLeasesResponse) TotalPriceAmount() sdk.Dec { + total := sdk.NewDec(0) + + for _, lease := range m.Leases { + total = total.Add(lease.Lease.Price.Amount) + } + + return total +} diff --git a/go/node/take/v1beta3/params.pb.go b/go/node/take/v1beta3/params.pb.go index 49283e36..b43aa0f0 100644 --- a/go/node/take/v1beta3/params.pb.go +++ b/go/node/take/v1beta3/params.pb.go @@ -23,6 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// DenomTakeRate describes take rate for specified denom type DenomTakeRate struct { Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom" yaml:"denom"` Rate uint32 `protobuf:"varint,2,opt,name=rate,proto3" json:"rate" yaml:"rate"` diff --git a/proto/node/akash/base/v1beta3/resources.proto b/proto/node/akash/base/v1beta3/resources.proto index a4e64982..050ed269 100644 --- a/proto/node/akash/base/v1beta3/resources.proto +++ b/proto/node/akash/base/v1beta3/resources.proto @@ -43,9 +43,9 @@ message Resources { (gogoproto.moretags) = "yaml:\"gpu,omitempty\"" ]; repeated Endpoint endpoints = 6 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "Endpoints", - (gogoproto.jsontag) = "endpoints", - (gogoproto.moretags) = "yaml:\"endpoints\"" + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "Endpoints", + (gogoproto.jsontag) = "endpoints", + (gogoproto.moretags) = "yaml:\"endpoints\"" ]; } diff --git a/proto/node/akash/deployment/v1beta3/resourceunit.proto b/proto/node/akash/deployment/v1beta3/resourceunit.proto index d96d6bb9..29c2a7f9 100644 --- a/proto/node/akash/deployment/v1beta3/resourceunit.proto +++ b/proto/node/akash/deployment/v1beta3/resourceunit.proto @@ -9,7 +9,7 @@ option go_package = "github.com/akash-network/akash-api/go/node/deployment/v1bet // ResourceUnit extends Resources and adds Count along with the Price message ResourceUnit { - option (gogoproto.equal) = false; + option (gogoproto.equal) = true; akash.base.v1beta3.Resources resource = 1 [ (gogoproto.nullable) = false, diff --git a/proto/node/akash/market/v1beta4/bid.proto b/proto/node/akash/market/v1beta4/bid.proto new file mode 100644 index 00000000..0af39505 --- /dev/null +++ b/proto/node/akash/market/v1beta4/bid.proto @@ -0,0 +1,199 @@ +syntax = "proto3"; +package akash.market.v1beta4; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +import "akash/base/v1beta3/resources.proto"; +import "akash/market/v1beta4/order.proto"; + +option go_package = "github.com/akash-network/akash-api/go/node/market/v1beta4"; + +// ResourceOffer describes resources that provider is offering +// for deployment +message ResourceOffer { + option (gogoproto.equal) = true; + akash.base.v1beta3.Resources resources = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "resources", + (gogoproto.moretags) = 'yaml:"resources"' + ]; + uint32 count = 2 [ + (gogoproto.jsontag) = "count", + (gogoproto.moretags) = 'yaml:"count"' + ]; +} + +// MsgCreateBid defines an SDK message for creating Bid +message MsgCreateBid { + option (gogoproto.equal) = false; + + OrderID order = 1 [ + (gogoproto.customname) = "Order", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "order", + (gogoproto.moretags) = 'yaml:"order"' + ]; + string provider = 2 [ + (gogoproto.jsontag) = "provider", + (gogoproto.moretags) = 'yaml:"provider"' + ]; + cosmos.base.v1beta1.DecCoin price = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "price", + (gogoproto.moretags) = 'yaml:"price"' + ]; + cosmos.base.v1beta1.Coin deposit = 4 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "deposit", + (gogoproto.moretags) = 'yaml:"deposit"' + ]; + repeated ResourceOffer resources_offer = 5 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "ResourcesOffer", + (gogoproto.customname) = "ResourcesOffer", + (gogoproto.jsontag) = "resources_offer", + (gogoproto.moretags) = 'yaml:"resources_offer"' + ]; +} + +// MsgCreateBidResponse defines the Msg/CreateBid response type. +message MsgCreateBidResponse {} + +// MsgCloseBid defines an SDK message for closing bid +message MsgCloseBid { + option (gogoproto.equal) = false; + + BidID bid_id = 1 [ + (gogoproto.customname) = "BidID", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "id", + (gogoproto.moretags) = 'yaml:"id"' + ]; +} + +// MsgCloseBidResponse defines the Msg/CloseBid response type. +message MsgCloseBidResponse {} + +// BidID stores owner and all other seq numbers +// A successful bid becomes a Lease(ID). +message BidID { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + + string owner = 1 [ + (gogoproto.jsontag) = "owner", + (gogoproto.moretags) = 'yaml:"owner"' + ]; + uint64 dseq = 2 [ + (gogoproto.customname) = "DSeq", + (gogoproto.jsontag) = "dseq", + (gogoproto.moretags) = 'yaml:"dseq"' + ]; + uint32 gseq = 3 [ + (gogoproto.customname) = "GSeq", + (gogoproto.jsontag) = "gseq", + (gogoproto.moretags) = 'yaml:"gseq"' + ]; + uint32 oseq = 4 [ + (gogoproto.customname) = "OSeq", + (gogoproto.jsontag) = "oseq", + (gogoproto.moretags) = 'yaml:"oseq"' + ]; + string provider = 5 [ + (gogoproto.jsontag) = "provider", + (gogoproto.moretags) = 'yaml:"provider"' + ]; +} + +// Bid stores BidID, state of bid and price +message Bid { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + + BidID bid_id = 1 [ + (gogoproto.customname) = "BidID", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "id", + (gogoproto.moretags) = 'yaml:"id"' + ]; + + // State is an enum which refers to state of bid + enum State { + option (gogoproto.goproto_enum_prefix) = false; + + // Prefix should start with 0 in enum. So declaring dummy state + invalid = 0 [ + (gogoproto.enumvalue_customname) = "BidStateInvalid" + ]; + // BidOpen denotes state for bid open + open = 1 [ + (gogoproto.enumvalue_customname) = "BidOpen" + ]; + // BidMatched denotes state for bid open + active = 2 [ + (gogoproto.enumvalue_customname) = "BidActive" + ]; + // BidLost denotes state for bid lost + lost = 3 [ + (gogoproto.enumvalue_customname) = "BidLost" + ]; + // BidClosed denotes state for bid closed + closed = 4 [ + (gogoproto.enumvalue_customname) = "BidClosed" + ]; + } + + State state = 2 [ + (gogoproto.jsontag) = "state", + (gogoproto.moretags) = 'yaml:"state"' + ]; + + cosmos.base.v1beta1.DecCoin price = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "price", + (gogoproto.moretags) = 'yaml:"price"' + ]; + int64 created_at = 4; + + repeated ResourceOffer resources_offer = 5 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "ResourcesOffer", + (gogoproto.customname) = "ResourcesOffer", + (gogoproto.jsontag) = "resources_offer", + (gogoproto.moretags) = 'yaml:"resources_offer"' + ]; +} + +// BidFilters defines flags for bid list filter +message BidFilters { + option (gogoproto.equal) = false; + + string owner = 1 [ + (gogoproto.jsontag) = "owner", + (gogoproto.moretags) = 'yaml:"owner"' + ]; + uint64 dseq = 2 [ + (gogoproto.customname) = "DSeq", + (gogoproto.jsontag) = "dseq", + (gogoproto.moretags) = 'yaml:"dseq"' + ]; + uint32 gseq = 3 [ + (gogoproto.customname) = "GSeq", + (gogoproto.jsontag) = "gseq", + (gogoproto.moretags) = 'yaml:"gseq"' + ]; + uint32 oseq = 4 [ + (gogoproto.customname) = "OSeq", + (gogoproto.jsontag) = "oseq", + (gogoproto.moretags) = 'yaml:"oseq"' + ]; + string provider = 5 [ + (gogoproto.jsontag) = "provider", + (gogoproto.moretags) = 'yaml:"provider"' + ]; + string state = 6 [ + (gogoproto.jsontag) = "state", + (gogoproto.moretags) = 'yaml:"state"' + ]; +} diff --git a/proto/node/akash/market/v1beta4/genesis.proto b/proto/node/akash/market/v1beta4/genesis.proto new file mode 100644 index 00000000..e22dd504 --- /dev/null +++ b/proto/node/akash/market/v1beta4/genesis.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; +package akash.market.v1beta4; + +import "gogoproto/gogo.proto"; +import "akash/market/v1beta4/order.proto"; +import "akash/market/v1beta4/lease.proto"; +import "akash/market/v1beta4/bid.proto"; +import "akash/market/v1beta4/params.proto"; + +option go_package = "github.com/akash-network/akash-api/go/node/market/v1beta4"; + +// GenesisState defines the basic genesis state used by market module +message GenesisState { + Params params = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "params", + (gogoproto.moretags) = 'yaml:"params"' + ]; + repeated Order orders = 2 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "orders", + (gogoproto.moretags) = 'yaml:"orders"' + ]; + repeated Lease leases = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "leases", + (gogoproto.moretags) = 'yaml:"leases"' + ]; + repeated Bid bids = 4 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "bids", + (gogoproto.moretags) = 'yaml:"bids"' + ]; +} diff --git a/proto/node/akash/market/v1beta4/lease.proto b/proto/node/akash/market/v1beta4/lease.proto new file mode 100644 index 00000000..6e89feb1 --- /dev/null +++ b/proto/node/akash/market/v1beta4/lease.proto @@ -0,0 +1,164 @@ +syntax = "proto3"; +package akash.market.v1beta4; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "akash/market/v1beta4/bid.proto"; + +option go_package = "github.com/akash-network/akash-api/go/node/market/v1beta4"; + +// LeaseID stores bid details of lease +message LeaseID { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + + string owner = 1 [ + (gogoproto.jsontag) = "owner", + (gogoproto.moretags) = 'yaml:"owner"' + ]; + uint64 dseq = 2 [ + (gogoproto.customname) = "DSeq", + (gogoproto.jsontag) = "dseq", + (gogoproto.moretags) = 'yaml:"dseq"' + ]; + uint32 gseq = 3 [ + (gogoproto.customname) = "GSeq", + (gogoproto.jsontag) = "gseq", + (gogoproto.moretags) = 'yaml:"gseq"' + ]; + uint32 oseq = 4 [ + (gogoproto.customname) = "OSeq", + (gogoproto.jsontag) = "oseq", + (gogoproto.moretags) = 'yaml:"oseq"' + ]; + string provider = 5 [ + (gogoproto.jsontag) = "provider", + (gogoproto.moretags) = 'yaml:"provider"' + ]; +} + +// Lease stores LeaseID, state of lease and price +message Lease { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + + LeaseID lease_id = 1 [ + (gogoproto.customname) = "LeaseID", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "id", + (gogoproto.moretags) = 'yaml:"id"' + ]; + + // State is an enum which refers to state of lease + enum State { + option (gogoproto.goproto_enum_prefix) = false; + + // Prefix should start with 0 in enum. So declaring dummy state + invalid = 0 [ + (gogoproto.enumvalue_customname) = "LeaseStateInvalid" + ]; + // LeaseActive denotes state for lease active + active = 1 [ + (gogoproto.enumvalue_customname) = "LeaseActive" + ]; + // LeaseInsufficientFunds denotes state for lease insufficient_funds + insufficient_funds = 2 [ + (gogoproto.enumvalue_customname) = "LeaseInsufficientFunds" + ]; + // LeaseClosed denotes state for lease closed + closed = 3 [ + (gogoproto.enumvalue_customname) = "LeaseClosed" + ]; + } + + State state = 2 [ + (gogoproto.jsontag) = "state", + (gogoproto.moretags) = 'yaml:"state"' + ]; + cosmos.base.v1beta1.DecCoin price = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "price", + (gogoproto.moretags) = 'yaml:"price"' + ]; + int64 created_at = 4; + int64 closed_on = 5; +} + +// LeaseFilters defines flags for lease list filter +message LeaseFilters { + option (gogoproto.equal) = false; + + string owner = 1 [ + (gogoproto.jsontag) = "owner", + (gogoproto.moretags) = 'yaml:"owner"' + ]; + uint64 dseq = 2 [ + (gogoproto.customname) = "DSeq", + (gogoproto.jsontag) = "dseq", + (gogoproto.moretags) = 'yaml:"dseq"' + ]; + uint32 gseq = 3 [ + (gogoproto.customname) = "GSeq", + (gogoproto.jsontag) = "gseq", + (gogoproto.moretags) = 'yaml:"gseq"' + ]; + uint32 oseq = 4 [ + (gogoproto.customname) = "OSeq", + (gogoproto.jsontag) = "oseq", + (gogoproto.moretags) = 'yaml:"oseq"' + ]; + string provider = 5 [ + (gogoproto.jsontag) = "provider", + (gogoproto.moretags) = 'yaml:"provider"' + ]; + string state = 6 [ + (gogoproto.jsontag) = "state", + (gogoproto.moretags) = 'yaml:"state"' + ]; +} + +// MsgCreateLease is sent to create a lease +message MsgCreateLease { + option (gogoproto.equal) = false; + + BidID bid_id = 1 [ + (gogoproto.customname) = "BidID", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "id", + (gogoproto.moretags) = 'yaml:"id"' + ]; +} + +// MsgCreateLeaseResponse is the response from creating a lease +message MsgCreateLeaseResponse {} + +// MsgWithdrawLease defines an SDK message for closing bid +message MsgWithdrawLease { + option (gogoproto.equal) = false; + + LeaseID bid_id = 1 [ + (gogoproto.customname) = "LeaseID", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "id", + (gogoproto.moretags) = 'yaml:"id"' + ]; +} + +// MsgWithdrawLeaseResponse defines the Msg/WithdrawLease response type. +message MsgWithdrawLeaseResponse {} + + +// MsgCloseLease defines an SDK message for closing order +message MsgCloseLease { + option (gogoproto.equal) = false; + + LeaseID lease_id = 1 [ + (gogoproto.customname) = "LeaseID", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "id", + (gogoproto.moretags) = 'yaml:"id"' + ]; +} + +// MsgCloseLeaseResponse defines the Msg/CloseLease response type. +message MsgCloseLeaseResponse {} diff --git a/proto/node/akash/market/v1beta4/order.proto b/proto/node/akash/market/v1beta4/order.proto new file mode 100644 index 00000000..0b393806 --- /dev/null +++ b/proto/node/akash/market/v1beta4/order.proto @@ -0,0 +1,109 @@ +syntax = "proto3"; +package akash.market.v1beta4; + +import "gogoproto/gogo.proto"; +import "akash/deployment/v1beta3/groupspec.proto"; + +option go_package = "github.com/akash-network/akash-api/go/node/market/v1beta4"; + +// OrderID stores owner and all other seq numbers +message OrderID { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + + string owner = 1 [ + (gogoproto.jsontag) = "owner", + (gogoproto.moretags) = 'yaml:"owner"' + ]; + uint64 dseq = 2 [ + (gogoproto.customname) = "DSeq", + (gogoproto.jsontag) = "dseq", + (gogoproto.moretags) = 'yaml:"dseq"' + ]; + uint32 gseq = 3 [ + (gogoproto.customname) = "GSeq", + (gogoproto.jsontag) = "gseq", + (gogoproto.moretags) = 'yaml:"gseq"' + ]; + uint32 oseq = 4 [ + (gogoproto.customname) = "OSeq", + (gogoproto.jsontag) = "oseq", + (gogoproto.moretags) = 'yaml:"oseq"' + ]; +} + +// Order stores orderID, state of order and other details +message Order { + option (gogoproto.equal) = false; + option (gogoproto.goproto_stringer) = false; + + OrderID order_id = 1 [ + (gogoproto.customname) = "OrderID", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "id", + (gogoproto.moretags) = 'yaml:"id"' + ]; + + // State is an enum which refers to state of order + enum State { + option (gogoproto.goproto_enum_prefix) = false; + + // Prefix should start with 0 in enum. So declaring dummy state + invalid = 0 [ + (gogoproto.enumvalue_customname) = "OrderStateInvalid" + ]; + // OrderOpen denotes state for order open + open = 1 [ + (gogoproto.enumvalue_customname) = "OrderOpen" + ]; + // OrderMatched denotes state for order matched + active = 2 [ + (gogoproto.enumvalue_customname) = "OrderActive" + ]; + // OrderClosed denotes state for order lost + closed = 3 [ + (gogoproto.enumvalue_customname) = "OrderClosed" + ]; + } + + State state = 2 [ + (gogoproto.jsontag) = "state", + (gogoproto.moretags) = 'yaml:"state"' + ]; + akash.deployment.v1beta3.GroupSpec spec = 3 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "spec", + (gogoproto.moretags) = 'yaml:"spec"' + ]; + + int64 created_at = 4; +} + +// OrderFilters defines flags for order list filter +message OrderFilters { + option (gogoproto.equal) = false; + + string owner = 1 [ + (gogoproto.jsontag) = "owner", + (gogoproto.moretags) = 'yaml:"owner"' + ]; + uint64 dseq = 2 [ + (gogoproto.customname) = "DSeq", + (gogoproto.jsontag) = "dseq", + (gogoproto.moretags) = 'yaml:"dseq"' + ]; + uint32 gseq = 3 [ + (gogoproto.customname) = "GSeq", + (gogoproto.jsontag) = "gseq", + (gogoproto.moretags) = 'yaml:"gseq"' + ]; + uint32 oseq = 4 [ + (gogoproto.customname) = "OSeq", + (gogoproto.jsontag) = "oseq", + (gogoproto.moretags) = 'yaml:"oseq"' + ]; + string state = 5 [ + (gogoproto.jsontag) = "state", + (gogoproto.moretags) = 'yaml:"state"' + ]; +} diff --git a/proto/node/akash/market/v1beta4/params.proto b/proto/node/akash/market/v1beta4/params.proto new file mode 100644 index 00000000..3dff6706 --- /dev/null +++ b/proto/node/akash/market/v1beta4/params.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; +package akash.market.v1beta4; + +import "gogoproto/gogo.proto"; +import "cosmos/base/v1beta1/coin.proto"; + +option go_package = "github.com/akash-network/akash-api/go/node/market/v1beta4"; + +// Params is the params for the x/market module +message Params { + cosmos.base.v1beta1.Coin bid_min_deposit = 1 [ + (gogoproto.customname) = "BidMinDeposit", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "bid_min_deposit", + (gogoproto.moretags) = 'yaml:"bid_min_deposit"' + ]; + uint32 order_max_bids = 2 [ + (gogoproto.customname) = "OrderMaxBids", + (gogoproto.jsontag) = "order_max_bids", + (gogoproto.moretags) = 'yaml:"order_max_bids"' + ]; +} diff --git a/proto/node/akash/market/v1beta4/query.proto b/proto/node/akash/market/v1beta4/query.proto new file mode 100644 index 00000000..7260e013 --- /dev/null +++ b/proto/node/akash/market/v1beta4/query.proto @@ -0,0 +1,151 @@ +syntax = "proto3"; +package akash.market.v1beta4; + +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; + +import "akash/escrow/v1beta3/types.proto"; + +import "akash/market/v1beta4/order.proto"; +import "akash/market/v1beta4/bid.proto"; +import "akash/market/v1beta4/lease.proto"; + +option go_package = "github.com/akash-network/akash-api/go/node/market/v1beta4"; + +// Query defines the gRPC querier service +service Query { + // Orders queries orders with filters + rpc Orders(QueryOrdersRequest) returns (QueryOrdersResponse) { + option (google.api.http).get = "/akash/market/v1beta4/orders/list"; + } + + // Order queries order details + rpc Order(QueryOrderRequest) returns (QueryOrderResponse) { + option (google.api.http).get = "/akash/market/v1beta4/orders/info"; + } + + // Bids queries bids with filters + rpc Bids(QueryBidsRequest) returns (QueryBidsResponse) { + option (google.api.http).get = "/akash/market/v1beta4/bids/list"; + } + + // Bid queries bid details + rpc Bid(QueryBidRequest) returns (QueryBidResponse) { + option (google.api.http).get = "/akash/market/v1beta4/bids/info"; + } + + // Leases queries leases with filters + rpc Leases(QueryLeasesRequest) returns (QueryLeasesResponse) { + option (google.api.http).get = "/akash/market/v1beta4/leases/list"; + } + + // Lease queries lease details + rpc Lease(QueryLeaseRequest) returns (QueryLeaseResponse) { + option (google.api.http).get = "/akash/market/v1beta4/leases/info"; + } +} + +// QueryOrdersRequest is request type for the Query/Orders RPC method +message QueryOrdersRequest { + OrderFilters filters = 1 [ + (gogoproto.nullable) = false + ]; + + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryOrdersResponse is response type for the Query/Orders RPC method +message QueryOrdersResponse { + repeated Order orders = 1 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "Orders" + ]; + + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryOrderRequest is request type for the Query/Order RPC method +message QueryOrderRequest { + OrderID id = 1 [ + (gogoproto.nullable) = false, + (gogoproto.customname) = "ID" + ]; +} + +// QueryOrderResponse is response type for the Query/Order RPC method +message QueryOrderResponse { + Order order = 1 [ + (gogoproto.nullable) = false + ]; +} + +// QueryBidsRequest is request type for the Query/Bids RPC method +message QueryBidsRequest { + BidFilters filters = 1 [ + (gogoproto.nullable) = false + ]; + + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryBidsResponse is response type for the Query/Bids RPC method +message QueryBidsResponse { + repeated QueryBidResponse bids = 1 [ + (gogoproto.nullable) = false + ]; + + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryBidRequest is request type for the Query/Bid RPC method +message QueryBidRequest { + BidID id = 1 [ + (gogoproto.nullable) = false, + (gogoproto.customname) = "ID" + ]; +} + +// QueryBidResponse is response type for the Query/Bid RPC method +message QueryBidResponse { + Bid bid = 1 [(gogoproto.nullable) = false]; + akash.escrow.v1beta3.Account escrow_account = 2 [ + (gogoproto.nullable) = false + ]; +} + +// QueryLeasesRequest is request type for the Query/Leases RPC method +message QueryLeasesRequest { + LeaseFilters filters = 1 [ + (gogoproto.nullable) = false + ]; + + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryLeasesResponse is response type for the Query/Leases RPC method +message QueryLeasesResponse { + repeated QueryLeaseResponse leases = 1 [ + (gogoproto.nullable) = false + ]; + + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryLeaseRequest is request type for the Query/Lease RPC method +message QueryLeaseRequest { + LeaseID id = 1 [ + (gogoproto.nullable) = false, + (gogoproto.customname) = "ID" + ]; +} + +// QueryLeaseResponse is response type for the Query/Lease RPC method +message QueryLeaseResponse { + Lease lease = 1 [ + (gogoproto.nullable) = false + ]; + akash.escrow.v1beta3.FractionalPayment escrow_payment = 2 [ + (gogoproto.nullable) = false + ]; +} diff --git a/proto/node/akash/market/v1beta4/service.proto b/proto/node/akash/market/v1beta4/service.proto new file mode 100644 index 00000000..5177a431 --- /dev/null +++ b/proto/node/akash/market/v1beta4/service.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; +package akash.market.v1beta4; + +import "akash/market/v1beta4/bid.proto"; +import "akash/market/v1beta4/lease.proto"; + +option go_package = "github.com/akash-network/akash-api/go/node/market/v1beta4"; + +// Msg defines the market Msg service +service Msg { + // CreateBid defines a method to create a bid given proper inputs. + rpc CreateBid(MsgCreateBid) returns (MsgCreateBidResponse); + + // CloseBid defines a method to close a bid given proper inputs. + rpc CloseBid(MsgCloseBid) returns (MsgCloseBidResponse); + + // WithdrawLease withdraws accrued funds from the lease payment + rpc WithdrawLease(MsgWithdrawLease) returns (MsgWithdrawLeaseResponse); + + // CreateLease creates a new lease + rpc CreateLease(MsgCreateLease) returns (MsgCreateLeaseResponse); + + // CloseLease defines a method to close an order given proper inputs. + rpc CloseLease(MsgCloseLease) returns (MsgCloseLeaseResponse); +} diff --git a/proto/node/buf.yaml b/proto/node/buf.yaml index 64c72267..40bce3e7 100644 --- a/proto/node/buf.yaml +++ b/proto/node/buf.yaml @@ -36,6 +36,7 @@ lint: - akash/inflation/v1beta2 - akash/market/v1beta1 - akash/market/v1beta2 + - akash/market/v1beta3 - akash/deployment/v1beta1 - akash/deployment/v1beta2 - akash/provider/v1beta1 diff --git a/proto/provider/buf.yaml b/proto/provider/buf.yaml index b2aed941..51286dfb 100644 --- a/proto/provider/buf.yaml +++ b/proto/provider/buf.yaml @@ -1,7 +1,8 @@ # This module represents buf.build/akash-network/manifest version: v1 name: buf.build/akash-network/manifest -#deps: +deps: + - buf.build/akash-network/node # - buf.build/cosmos/cosmos-proto # - buf.build/cosmos/cosmos-sdk # - buf.build/cosmos/gogo-proto