From 7fed3885b37b298e6bfc79c121d81918e3642b7d Mon Sep 17 00:00:00 2001 From: sheldon <997166273@qq.com> Date: Tue, 29 Nov 2022 18:44:11 +0800 Subject: [PATCH 01/20] add adr 4907 --- docs/architecture/adr-4907-rental-nft.md | 181 +++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 docs/architecture/adr-4907-rental-nft.md diff --git a/docs/architecture/adr-4907-rental-nft.md b/docs/architecture/adr-4907-rental-nft.md new file mode 100644 index 00000000..6e7973e7 --- /dev/null +++ b/docs/architecture/adr-4907-rental-nft.md @@ -0,0 +1,181 @@ +# ADR 4907: Rental NFT + +## Changelog + +* 2022-10-19: Initial Draft + +## Status + +DRAFT + +## Abstract + +This ADR is an extension to `x/nft`. It proposes an additional role (user) that can be granted to an address, and when that role is automatically revoked (expired). User roles represent permissions to "use" NFTs, but not the ability to transfer or set up users. This standard is fully compliant with `EIP-4907` + +## Context + +At present, `x/nft` only implements the basic interface of `EIP-721`. In some cases, many developers may need certain functions. For example, the current NFT has high artistic value, and of course the price will be high. At this time, it is meaningful for the entire ecology to have a module with the ability to lease NFT. + +## Decision + +We extend based on `irismod/modules/nft`, which extends the following functions: + +- Store rental information for NFTs +- Expose the `Keeper` interface for writing modules for renting NFTs. +- Expose the external `Message` interface for users to rent out the right to use the NFT they own. +- Query NFT rental information. + +### Rental + +Rental is an extension of NFT, mainly to allow NFT to support rental. + +- rentalInfo: -- The structure in which the Rental information is kept. + +### Types + +#### RentalInfo + +``` +message RentalInfo { + string renter = 1; + uint64 expires = 2; +} +``` + +- `renter`:is the renter address of `RentalInfo`; required +- `expires`:is the time of the rental of `RentalInfo`; required + +### Storage + +A total of one style needs to be stored for royalties: + +1. `{class_id}/{nft_id} ---->RentalInfo (bytes) `:Store the information that an NFT is leased + +### `Keeper` Interface + +``` +type Keeper interface { + UserOf(ctx sdk.Context, classId, nftId string) (renter string) + UserExpires(ctx sdk.Context, classId, nftId string) (expire uint64) + + SetUser(ctx sdk.Context, classId, nftId string, renter string, expire uint64) + + // determines whether the NFT is being rented + HaveUser(ctx sdk.Context, classId, nftId string) bool + + // Delete rental information after expiration + // should be call in EndBlock + DeleteUser(ctx sdk.Context, classId, nftId string) +} +``` + + + +### `Msg` Service + +``` +service Msg { + rpc SetUser(MsgSetUser) returns (MsgSetUserResponse) {} +} + +message MsgSetUser { + string class_id = 1; + string nft_id = 2; + string renter = 3; + uint64 expire = 4; + + string sender = 5; +} + +message MsgSetUserResponse {} + +``` + +The implementation outline of the server is as follows: + +``` +type msgServer struct { + k Keeper +} + +func (m msgServer) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.MsgSetUserResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // check current ownership + assertEqual(msg.Sender, m.k.GetOwnerFromClass(msg.Module, msg.ClassId)) + + // check whether the nft is not already rented + assertEqual(false, m.k.HaveUser(ctx, msg.classId, msg.NftId)) + + m.k.SetUser(ctx, msg.classId, msg.NftId, msg.Renter, uint64(msg.Expire)) + return &types.MsgSetUserResponse{}, nil +} + +``` + +Query method: + +``` +service Query { + rpc UserOf(MsgUserOfRequest) returns (MsgUserOfResponse); + rpc UserExpires(MsgUserExpiresRequest) returns (MsgUserExpiresResponse); + rpc HaveUser(MsgHaveUserRequest) returns (MsgHaveUserResponse); +} + +message MsgUserOfRequest { + string class_id = 1; + string nft_id = 2; +} + +message MsgUserOfResponse { + string renter = 1; +} + +message MsgUserExpiresRequest { + string class_id = 1; + string nft_id = 2; +} + +message MsgUserExpiresResponse { + uint64 expires = 1; +} + +message MsgHaveUserRequest { + string class_id = 1; + string nft_id = 2; +} + +message MsgHaveUserResponse { + bool had_renter = 1; +} + +``` + + + +## Consequences + +### Backwards Compatibility + +No backwards incompatibility. + +### Positive + +- NFT Rental Standard on Cosmos Hub. + +### Negative + +None + +### Neutral + +None + +## Further Discussions + + + + + +## References + From 98b348ba3560103ee737ca8df863b83e82d914bd Mon Sep 17 00:00:00 2001 From: yuandu Date: Wed, 14 Dec 2022 15:41:34 +0800 Subject: [PATCH 02/20] generate rental proto --- modules/rental/types/genesis.pb.go | 322 +++++++ modules/rental/types/query.pb.go | 1400 ++++++++++++++++++++++++++++ modules/rental/types/rental.pb.go | 338 +++++++ modules/rental/types/tx.pb.go | 680 ++++++++++++++ proto/rental/genesis.proto | 12 + proto/rental/query.proto | 28 + proto/rental/rental.proto | 12 + proto/rental/tx.proto | 21 + 8 files changed, 2813 insertions(+) create mode 100644 modules/rental/types/genesis.pb.go create mode 100644 modules/rental/types/query.pb.go create mode 100644 modules/rental/types/rental.pb.go create mode 100644 modules/rental/types/tx.pb.go create mode 100644 proto/rental/genesis.proto create mode 100644 proto/rental/query.proto create mode 100644 proto/rental/rental.proto create mode 100644 proto/rental/tx.proto diff --git a/modules/rental/types/genesis.pb.go b/modules/rental/types/genesis.pb.go new file mode 100644 index 00000000..fe520d61 --- /dev/null +++ b/modules/rental/types/genesis.pb.go @@ -0,0 +1,322 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: rental/genesis.proto + +package types + +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 + +type GenesisState struct { + RenterInfos []RentalInfo `protobuf:"bytes,1,rep,name=renterInfos,proto3" json:"renterInfos"` +} + +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_2f80438895461b63, []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 init() { + proto.RegisterType((*GenesisState)(nil), "irismod.rental.GenesisState") +} + +func init() { proto.RegisterFile("rental/genesis.proto", fileDescriptor_2f80438895461b63) } + +var fileDescriptor_2f80438895461b63 = []byte{ + // 204 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4a, 0xcd, 0x2b, + 0x49, 0xcc, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, + 0x17, 0xe2, 0xcb, 0x2c, 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0xc8, 0x4a, 0x89, 0xa4, 0xe7, + 0xa7, 0xe7, 0x83, 0xa5, 0xf4, 0x41, 0x2c, 0x88, 0x2a, 0x29, 0x61, 0xa8, 0x5e, 0x08, 0x05, 0x11, + 0x54, 0x0a, 0xe2, 0xe2, 0x71, 0x87, 0x98, 0x15, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0xe4, 0xc4, 0xc5, + 0x0d, 0x92, 0x4f, 0x2d, 0xf2, 0xcc, 0x4b, 0xcb, 0x2f, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, + 0x92, 0xd2, 0x43, 0xb5, 0x40, 0x2f, 0x08, 0x4c, 0x81, 0x94, 0x38, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, + 0x10, 0x84, 0xac, 0xc9, 0xc9, 0xf7, 0xc4, 0x43, 0x39, 0x86, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, + 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, + 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, + 0x07, 0x19, 0x9b, 0x97, 0x5a, 0xa2, 0x0f, 0x35, 0x5e, 0x3f, 0x37, 0x3f, 0xa5, 0x34, 0x27, 0xb5, + 0x18, 0xea, 0x44, 0xfd, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x4b, 0x8d, 0x01, 0x01, + 0x00, 0x00, 0xff, 0xff, 0x32, 0x8d, 0x8a, 0x7d, 0xfc, 0x00, 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.RenterInfos) > 0 { + for iNdEx := len(m.RenterInfos) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RenterInfos[iNdEx].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 + if len(m.RenterInfos) > 0 { + for _, e := range m.RenterInfos { + 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 RenterInfos", 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.RenterInfos = append(m.RenterInfos, RentalInfo{}) + if err := m.RenterInfos[len(m.RenterInfos)-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/modules/rental/types/query.pb.go b/modules/rental/types/query.pb.go new file mode 100644 index 00000000..d9962c91 --- /dev/null +++ b/modules/rental/types/query.pb.go @@ -0,0 +1,1400 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: rental/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + 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" + 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 + +type MsgUserOfRequest struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +} + +func (m *MsgUserOfRequest) Reset() { *m = MsgUserOfRequest{} } +func (m *MsgUserOfRequest) String() string { return proto.CompactTextString(m) } +func (*MsgUserOfRequest) ProtoMessage() {} +func (*MsgUserOfRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_716e6efac23cde5d, []int{0} +} +func (m *MsgUserOfRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUserOfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUserOfRequest.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 *MsgUserOfRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUserOfRequest.Merge(m, src) +} +func (m *MsgUserOfRequest) XXX_Size() int { + return m.Size() +} +func (m *MsgUserOfRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUserOfRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUserOfRequest proto.InternalMessageInfo + +type MsgUserOfResponse struct { + Renter string `protobuf:"bytes,1,opt,name=renter,proto3" json:"renter,omitempty"` +} + +func (m *MsgUserOfResponse) Reset() { *m = MsgUserOfResponse{} } +func (m *MsgUserOfResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUserOfResponse) ProtoMessage() {} +func (*MsgUserOfResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_716e6efac23cde5d, []int{1} +} +func (m *MsgUserOfResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUserOfResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUserOfResponse.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 *MsgUserOfResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUserOfResponse.Merge(m, src) +} +func (m *MsgUserOfResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUserOfResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUserOfResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUserOfResponse proto.InternalMessageInfo + +type MsgUserExpiresRequest struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +} + +func (m *MsgUserExpiresRequest) Reset() { *m = MsgUserExpiresRequest{} } +func (m *MsgUserExpiresRequest) String() string { return proto.CompactTextString(m) } +func (*MsgUserExpiresRequest) ProtoMessage() {} +func (*MsgUserExpiresRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_716e6efac23cde5d, []int{2} +} +func (m *MsgUserExpiresRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUserExpiresRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUserExpiresRequest.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 *MsgUserExpiresRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUserExpiresRequest.Merge(m, src) +} +func (m *MsgUserExpiresRequest) XXX_Size() int { + return m.Size() +} +func (m *MsgUserExpiresRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUserExpiresRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUserExpiresRequest proto.InternalMessageInfo + +type MsgUserExpiresResponse struct { + Expires uint64 `protobuf:"varint,1,opt,name=expires,proto3" json:"expires,omitempty"` +} + +func (m *MsgUserExpiresResponse) Reset() { *m = MsgUserExpiresResponse{} } +func (m *MsgUserExpiresResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUserExpiresResponse) ProtoMessage() {} +func (*MsgUserExpiresResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_716e6efac23cde5d, []int{3} +} +func (m *MsgUserExpiresResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUserExpiresResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUserExpiresResponse.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 *MsgUserExpiresResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUserExpiresResponse.Merge(m, src) +} +func (m *MsgUserExpiresResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUserExpiresResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUserExpiresResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUserExpiresResponse proto.InternalMessageInfo + +type MsgHaveUserRequest struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +} + +func (m *MsgHaveUserRequest) Reset() { *m = MsgHaveUserRequest{} } +func (m *MsgHaveUserRequest) String() string { return proto.CompactTextString(m) } +func (*MsgHaveUserRequest) ProtoMessage() {} +func (*MsgHaveUserRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_716e6efac23cde5d, []int{4} +} +func (m *MsgHaveUserRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgHaveUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgHaveUserRequest.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 *MsgHaveUserRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgHaveUserRequest.Merge(m, src) +} +func (m *MsgHaveUserRequest) XXX_Size() int { + return m.Size() +} +func (m *MsgHaveUserRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MsgHaveUserRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgHaveUserRequest proto.InternalMessageInfo + +type MsgHaveUserResponse struct { + HadRenter bool `protobuf:"varint,1,opt,name=had_renter,json=hadRenter,proto3" json:"had_renter,omitempty"` +} + +func (m *MsgHaveUserResponse) Reset() { *m = MsgHaveUserResponse{} } +func (m *MsgHaveUserResponse) String() string { return proto.CompactTextString(m) } +func (*MsgHaveUserResponse) ProtoMessage() {} +func (*MsgHaveUserResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_716e6efac23cde5d, []int{5} +} +func (m *MsgHaveUserResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgHaveUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgHaveUserResponse.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 *MsgHaveUserResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgHaveUserResponse.Merge(m, src) +} +func (m *MsgHaveUserResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgHaveUserResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgHaveUserResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgHaveUserResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgUserOfRequest)(nil), "irismod.rental.MsgUserOfRequest") + proto.RegisterType((*MsgUserOfResponse)(nil), "irismod.rental.MsgUserOfResponse") + proto.RegisterType((*MsgUserExpiresRequest)(nil), "irismod.rental.MsgUserExpiresRequest") + proto.RegisterType((*MsgUserExpiresResponse)(nil), "irismod.rental.MsgUserExpiresResponse") + proto.RegisterType((*MsgHaveUserRequest)(nil), "irismod.rental.MsgHaveUserRequest") + proto.RegisterType((*MsgHaveUserResponse)(nil), "irismod.rental.MsgHaveUserResponse") +} + +func init() { proto.RegisterFile("rental/query.proto", fileDescriptor_716e6efac23cde5d) } + +var fileDescriptor_716e6efac23cde5d = []byte{ + // 370 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xc1, 0x4a, 0xeb, 0x40, + 0x14, 0x86, 0x93, 0x72, 0x9b, 0xb6, 0xe7, 0xc2, 0xe5, 0xde, 0xb9, 0xb6, 0xd4, 0x80, 0xa1, 0x46, + 0x14, 0x41, 0xc8, 0x40, 0xf5, 0x09, 0x44, 0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bf, 0xc2, + 0x51, 0xc6, 0x7b, 0x00, 0x7d, 0x9f, 0xb4, 0x97, 0x5e, 0x5e, 0xf6, 0x2a, 0x7d, 0x9f, 0x78, 0xd9, + 0x45, 0xf3, 0xa5, 0x00, 0xc5, 0xdb, 0x74, 0x4b, 0xc8, 0x05, 0x23, 0x0f, 0x0c, 0x35, 0x9c, 0xd5, + 0x55, 0x39, 0xeb, 0x1b, 0x31, 0xf7, 0x37, 0x28, 0x94, 0xef, 0x23, 0xfc, 0x5e, 0xca, 0x01, 0x1d, + 0x7e, 0x33, 0xb1, 0x1a, 0xb9, 0x79, 0xf4, 0x93, 0x4c, 0xd1, 0xef, 0xa0, 0xbc, 0x78, 0x29, 0xb2, + 0xbf, 0x98, 0x59, 0x8b, 0xd3, 0x3c, 0xd8, 0xa8, 0xc9, 0xa1, 0xe7, 0xee, 0xe4, 0xc3, 0xd2, 0x26, + 0x33, 0x4b, 0x9f, 0xce, 0x2c, 0xfd, 0x7d, 0x66, 0xe9, 0xaf, 0x73, 0x4b, 0x9b, 0xce, 0x2d, 0xed, + 0x6d, 0x6e, 0x69, 0x0f, 0x38, 0x08, 0x65, 0x3f, 0xe9, 0x38, 0x5d, 0x36, 0xc4, 0x29, 0x2c, 0xa2, + 0x12, 0x2b, 0x28, 0x1e, 0x32, 0x92, 0x0c, 0xa8, 0xc0, 0xea, 0xdb, 0xcb, 0x71, 0x4c, 0x45, 0xc7, + 0xc8, 0x7e, 0xf4, 0xe9, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xde, 0x55, 0xc8, 0x39, 0x0d, 0x03, + 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 { + UserOf(ctx context.Context, in *MsgUserOfRequest, opts ...grpc.CallOption) (*MsgUserOfResponse, error) + UserExpires(ctx context.Context, in *MsgUserExpiresRequest, opts ...grpc.CallOption) (*MsgUserExpiresResponse, error) + HaveUser(ctx context.Context, in *MsgHaveUserRequest, opts ...grpc.CallOption) (*MsgHaveUserResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) UserOf(ctx context.Context, in *MsgUserOfRequest, opts ...grpc.CallOption) (*MsgUserOfResponse, error) { + out := new(MsgUserOfResponse) + err := c.cc.Invoke(ctx, "/irismod.rental.Query/UserOf", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) UserExpires(ctx context.Context, in *MsgUserExpiresRequest, opts ...grpc.CallOption) (*MsgUserExpiresResponse, error) { + out := new(MsgUserExpiresResponse) + err := c.cc.Invoke(ctx, "/irismod.rental.Query/UserExpires", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) HaveUser(ctx context.Context, in *MsgHaveUserRequest, opts ...grpc.CallOption) (*MsgHaveUserResponse, error) { + out := new(MsgHaveUserResponse) + err := c.cc.Invoke(ctx, "/irismod.rental.Query/HaveUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + UserOf(context.Context, *MsgUserOfRequest) (*MsgUserOfResponse, error) + UserExpires(context.Context, *MsgUserExpiresRequest) (*MsgUserExpiresResponse, error) + HaveUser(context.Context, *MsgHaveUserRequest) (*MsgHaveUserResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) UserOf(ctx context.Context, req *MsgUserOfRequest) (*MsgUserOfResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserOf not implemented") +} +func (*UnimplementedQueryServer) UserExpires(ctx context.Context, req *MsgUserExpiresRequest) (*MsgUserExpiresResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserExpires not implemented") +} +func (*UnimplementedQueryServer) HaveUser(ctx context.Context, req *MsgHaveUserRequest) (*MsgHaveUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HaveUser not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_UserOf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUserOfRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UserOf(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.rental.Query/UserOf", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UserOf(ctx, req.(*MsgUserOfRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_UserExpires_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUserExpiresRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UserExpires(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.rental.Query/UserExpires", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UserExpires(ctx, req.(*MsgUserExpiresRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_HaveUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgHaveUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).HaveUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.rental.Query/HaveUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HaveUser(ctx, req.(*MsgHaveUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.rental.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "UserOf", + Handler: _Query_UserOf_Handler, + }, + { + MethodName: "UserExpires", + Handler: _Query_UserExpires_Handler, + }, + { + MethodName: "HaveUser", + Handler: _Query_HaveUser_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "rental/query.proto", +} + +func (m *MsgUserOfRequest) 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 *MsgUserOfRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUserOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUserOfResponse) 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 *MsgUserOfResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUserOfResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Renter) > 0 { + i -= len(m.Renter) + copy(dAtA[i:], m.Renter) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Renter))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUserExpiresRequest) 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 *MsgUserExpiresRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUserExpiresRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUserExpiresResponse) 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 *MsgUserExpiresResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUserExpiresResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Expires != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Expires)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgHaveUserRequest) 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 *MsgHaveUserRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgHaveUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgHaveUserResponse) 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 *MsgHaveUserResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgHaveUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HadRenter { + i-- + if m.HadRenter { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + 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 *MsgUserOfRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *MsgUserOfResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Renter) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *MsgUserExpiresRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *MsgUserExpiresResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Expires != 0 { + n += 1 + sovQuery(uint64(m.Expires)) + } + return n +} + +func (m *MsgHaveUserRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *MsgHaveUserResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HadRenter { + n += 2 + } + 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 *MsgUserOfRequest) 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: MsgUserOfRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUserOfRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + 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 *MsgUserOfResponse) 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: MsgUserOfResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUserOfResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Renter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Renter = string(dAtA[iNdEx:postIndex]) + 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 *MsgUserExpiresRequest) 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: MsgUserExpiresRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUserExpiresRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + 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 *MsgUserExpiresResponse) 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: MsgUserExpiresResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUserExpiresResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) + } + m.Expires = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Expires |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgHaveUserRequest) 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: MsgHaveUserRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgHaveUserRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + 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 *MsgHaveUserResponse) 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: MsgHaveUserResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgHaveUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HadRenter", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HadRenter = bool(v != 0) + 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/modules/rental/types/rental.pb.go b/modules/rental/types/rental.pb.go new file mode 100644 index 00000000..129f2693 --- /dev/null +++ b/modules/rental/types/rental.pb.go @@ -0,0 +1,338 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: rental/rental.proto + +package types + +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 + +type RentalInfo struct { + Renter string `protobuf:"bytes,1,opt,name=renter,proto3" json:"renter,omitempty"` + Expires uint64 `protobuf:"varint,2,opt,name=expires,proto3" json:"expires,omitempty"` +} + +func (m *RentalInfo) Reset() { *m = RentalInfo{} } +func (m *RentalInfo) String() string { return proto.CompactTextString(m) } +func (*RentalInfo) ProtoMessage() {} +func (*RentalInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_a38471509ee7f89e, []int{0} +} +func (m *RentalInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RentalInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RentalInfo.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 *RentalInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RentalInfo.Merge(m, src) +} +func (m *RentalInfo) XXX_Size() int { + return m.Size() +} +func (m *RentalInfo) XXX_DiscardUnknown() { + xxx_messageInfo_RentalInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_RentalInfo proto.InternalMessageInfo + +func init() { + proto.RegisterType((*RentalInfo)(nil), "irismod.rental.RentalInfo") +} + +func init() { proto.RegisterFile("rental/rental.proto", fileDescriptor_a38471509ee7f89e) } + +var fileDescriptor_a38471509ee7f89e = []byte{ + // 187 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x4a, 0xcd, 0x2b, + 0x49, 0xcc, 0xd1, 0x87, 0x50, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x7c, 0x99, 0x45, 0x99, + 0xc5, 0xb9, 0xf9, 0x29, 0x7a, 0x10, 0x51, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0xb0, 0x94, 0x3e, + 0x88, 0x05, 0x51, 0xa5, 0x64, 0xc7, 0xc5, 0x15, 0x04, 0x96, 0xf7, 0xcc, 0x4b, 0xcb, 0x17, 0x12, + 0xe3, 0x62, 0x03, 0xa9, 0x4e, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0xf2, 0x84, + 0x24, 0xb8, 0xd8, 0x53, 0x2b, 0x0a, 0x32, 0x8b, 0x52, 0x8b, 0x25, 0x98, 0x14, 0x18, 0x35, 0x58, + 0x82, 0x60, 0x5c, 0x27, 0xdf, 0x13, 0x0f, 0xe5, 0x18, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, + 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, + 0x58, 0x8e, 0x21, 0x4a, 0x3f, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, + 0xe4, 0x9c, 0xbc, 0xd4, 0x12, 0x7d, 0xa8, 0xb3, 0xf4, 0x73, 0xf3, 0x53, 0x4a, 0x73, 0x52, 0x8b, + 0xa1, 0x8e, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xbb, 0xca, 0x18, 0x10, 0x00, + 0x00, 0xff, 0xff, 0x25, 0x45, 0xe8, 0x77, 0xd2, 0x00, 0x00, 0x00, +} + +func (m *RentalInfo) 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 *RentalInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RentalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Expires != 0 { + i = encodeVarintRental(dAtA, i, uint64(m.Expires)) + i-- + dAtA[i] = 0x10 + } + if len(m.Renter) > 0 { + i -= len(m.Renter) + copy(dAtA[i:], m.Renter) + i = encodeVarintRental(dAtA, i, uint64(len(m.Renter))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintRental(dAtA []byte, offset int, v uint64) int { + offset -= sovRental(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *RentalInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Renter) + if l > 0 { + n += 1 + l + sovRental(uint64(l)) + } + if m.Expires != 0 { + n += 1 + sovRental(uint64(m.Expires)) + } + return n +} + +func sovRental(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozRental(x uint64) (n int) { + return sovRental(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *RentalInfo) 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 ErrIntOverflowRental + } + 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: RentalInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RentalInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Renter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + 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 ErrInvalidLengthRental + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRental + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Renter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) + } + m.Expires = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Expires |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRental(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRental + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipRental(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, ErrIntOverflowRental + } + 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, ErrIntOverflowRental + } + 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, ErrIntOverflowRental + } + 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, ErrInvalidLengthRental + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupRental + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthRental + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthRental = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowRental = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupRental = fmt.Errorf("proto: unexpected end of group") +) diff --git a/modules/rental/types/tx.pb.go b/modules/rental/types/tx.pb.go new file mode 100644 index 00000000..d1ab5d74 --- /dev/null +++ b/modules/rental/types/tx.pb.go @@ -0,0 +1,680 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: rental/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + 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" + 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 + +type MsgSetUser struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + Renter string `protobuf:"bytes,3,opt,name=renter,proto3" json:"renter,omitempty"` + Expire uint64 `protobuf:"varint,4,opt,name=expire,proto3" json:"expire,omitempty"` + Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgSetUser) Reset() { *m = MsgSetUser{} } +func (m *MsgSetUser) String() string { return proto.CompactTextString(m) } +func (*MsgSetUser) ProtoMessage() {} +func (*MsgSetUser) Descriptor() ([]byte, []int) { + return fileDescriptor_94fd51cc9a4073b5, []int{0} +} +func (m *MsgSetUser) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetUser) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetUser.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 *MsgSetUser) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetUser.Merge(m, src) +} +func (m *MsgSetUser) XXX_Size() int { + return m.Size() +} +func (m *MsgSetUser) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetUser.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetUser proto.InternalMessageInfo + +type MsgSetUserResponse struct { +} + +func (m *MsgSetUserResponse) Reset() { *m = MsgSetUserResponse{} } +func (m *MsgSetUserResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetUserResponse) ProtoMessage() {} +func (*MsgSetUserResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_94fd51cc9a4073b5, []int{1} +} +func (m *MsgSetUserResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetUserResponse.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 *MsgSetUserResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetUserResponse.Merge(m, src) +} +func (m *MsgSetUserResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetUserResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetUserResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetUserResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgSetUser)(nil), "irismod.rental.MsgSetUser") + proto.RegisterType((*MsgSetUserResponse)(nil), "irismod.rental.MsgSetUserResponse") +} + +func init() { proto.RegisterFile("rental/tx.proto", fileDescriptor_94fd51cc9a4073b5) } + +var fileDescriptor_94fd51cc9a4073b5 = []byte{ + // 279 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xbd, 0x4e, 0xc3, 0x30, + 0x14, 0x85, 0x63, 0xda, 0xa6, 0xe0, 0x01, 0x24, 0xab, 0xa0, 0x90, 0xc1, 0xaa, 0x32, 0x75, 0x8a, + 0x25, 0x78, 0x03, 0xb6, 0x0a, 0x65, 0x09, 0x62, 0x61, 0x41, 0x6d, 0x7d, 0x1b, 0x22, 0x25, 0x76, + 0xe4, 0xeb, 0x4a, 0xe5, 0x05, 0x98, 0x79, 0xac, 0x8e, 0x1d, 0x19, 0x21, 0x79, 0x11, 0xe4, 0xfc, + 0xa8, 0x62, 0x60, 0xf3, 0x39, 0xdf, 0xf5, 0xf1, 0xf5, 0xa1, 0x57, 0x06, 0x94, 0x5d, 0x15, 0xc2, + 0xee, 0xe3, 0xca, 0x68, 0xab, 0xd9, 0x65, 0x6e, 0x72, 0x2c, 0xb5, 0x8c, 0x3b, 0x10, 0xce, 0x32, + 0x9d, 0xe9, 0x16, 0x09, 0x77, 0xea, 0xa6, 0xa2, 0x0f, 0x42, 0x69, 0x82, 0xd9, 0x13, 0xd8, 0x67, + 0x04, 0xc3, 0x6e, 0xe9, 0xf9, 0xa6, 0x58, 0x21, 0xbe, 0xe6, 0x32, 0x20, 0x73, 0xb2, 0xb8, 0x48, + 0xa7, 0xad, 0x5e, 0x4a, 0x76, 0x4d, 0x7d, 0xb5, 0xb5, 0x0e, 0x9c, 0xb5, 0x60, 0xa2, 0xb6, 0x76, + 0x29, 0xd9, 0x0d, 0xf5, 0xdd, 0x03, 0x60, 0x82, 0x51, 0x6b, 0xf7, 0xca, 0xf9, 0xb0, 0xaf, 0x72, + 0x03, 0xc1, 0x78, 0x4e, 0x16, 0xe3, 0xb4, 0x57, 0xce, 0x47, 0x50, 0x12, 0x4c, 0x30, 0xe9, 0xe6, + 0x3b, 0x15, 0xcd, 0x28, 0x3b, 0xed, 0x91, 0x02, 0x56, 0x5a, 0x21, 0xdc, 0xa5, 0x74, 0x94, 0x60, + 0xc6, 0x1e, 0xe9, 0x74, 0xd8, 0x30, 0x8c, 0xff, 0xfe, 0x2b, 0x3e, 0xdd, 0x0a, 0xa3, 0xff, 0xd9, + 0x90, 0x18, 0x79, 0x0f, 0xc9, 0xe1, 0x87, 0x7b, 0x87, 0x9a, 0x93, 0x63, 0xcd, 0xc9, 0x77, 0xcd, + 0xc9, 0x67, 0xc3, 0xbd, 0x63, 0xc3, 0xbd, 0xaf, 0x86, 0x7b, 0x2f, 0x22, 0xcb, 0xed, 0xdb, 0x6e, + 0x1d, 0x6f, 0x74, 0x29, 0x5c, 0x9a, 0x02, 0x2b, 0xfa, 0x54, 0x51, 0x6a, 0xb9, 0x2b, 0x00, 0xc5, + 0x50, 0xf5, 0x7b, 0x05, 0xb8, 0xf6, 0xdb, 0x22, 0xef, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x9c, + 0xce, 0x49, 0x44, 0x81, 0x01, 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 { + SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.CallOption) (*MsgSetUserResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.CallOption) (*MsgSetUserResponse, error) { + out := new(MsgSetUserResponse) + err := c.cc.Invoke(ctx, "/irismod.rental.Msg/SetUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + SetUser(context.Context, *MsgSetUser) (*MsgSetUserResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SetUser(ctx context.Context, req *MsgSetUser) (*MsgSetUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetUser not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetUser) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.rental.Msg/SetUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetUser(ctx, req.(*MsgSetUser)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "irismod.rental.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SetUser", + Handler: _Msg_SetUser_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "rental/tx.proto", +} + +func (m *MsgSetUser) 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 *MsgSetUser) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetUser) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x2a + } + if m.Expire != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Expire)) + i-- + dAtA[i] = 0x20 + } + if len(m.Renter) > 0 { + i -= len(m.Renter) + copy(dAtA[i:], m.Renter) + i = encodeVarintTx(dAtA, i, uint64(len(m.Renter))) + i-- + dAtA[i] = 0x1a + } + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetUserResponse) 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 *MsgSetUserResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSetUser) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Renter) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Expire != 0 { + n += 1 + sovTx(uint64(m.Expire)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetUserResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSetUser) 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 ErrIntOverflowTx + } + 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: MsgSetUser: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetUser: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Renter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Renter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expire", wireType) + } + m.Expire = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Expire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSetUserResponse) 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 ErrIntOverflowTx + } + 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: MsgSetUserResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/proto/rental/genesis.proto b/proto/rental/genesis.proto new file mode 100644 index 00000000..666022fa --- /dev/null +++ b/proto/rental/genesis.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package irismod.rental; + +import "gogoproto/gogo.proto"; +import "rental/rental.proto"; + +option go_package = "github.com/irisnet/irismod/modules/rental/types"; +option (gogoproto.goproto_getters_all) = false; + +message GenesisState { + repeated RentalInfo renterInfos = 1 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/rental/query.proto b/proto/rental/query.proto new file mode 100644 index 00000000..98c6346d --- /dev/null +++ b/proto/rental/query.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +package irismod.rental; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/irisnet/irismod/modules/rental/types"; +option (gogoproto.goproto_getters_all) = false; + +service Query { + rpc UserOf(MsgUserOfRequest) returns (MsgUserOfResponse); + rpc UserExpires(MsgUserExpiresRequest) returns (MsgUserExpiresResponse); + rpc HaveUser(MsgHaveUserRequest) returns (MsgHaveUserResponse); +} +message MsgUserOfRequest { + string class_id = 1; + string nft_id = 2; +} +message MsgUserOfResponse { string renter = 1; } +message MsgUserExpiresRequest { + string class_id = 1; + string nft_id = 2; +} +message MsgUserExpiresResponse { uint64 expires = 1; } +message MsgHaveUserRequest { + string class_id = 1; + string nft_id = 2; +} +message MsgHaveUserResponse { bool had_renter = 1; } \ No newline at end of file diff --git a/proto/rental/rental.proto b/proto/rental/rental.proto new file mode 100644 index 00000000..a09ea999 --- /dev/null +++ b/proto/rental/rental.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; +package irismod.rental; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/irisnet/irismod/modules/rental/types"; +option (gogoproto.goproto_getters_all) = false; + +message RentalInfo { + string renter = 1; + uint64 expires = 2; +} \ No newline at end of file diff --git a/proto/rental/tx.proto b/proto/rental/tx.proto new file mode 100644 index 00000000..bab2fe94 --- /dev/null +++ b/proto/rental/tx.proto @@ -0,0 +1,21 @@ +syntax = "proto3"; +package irismod.rental; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/irisnet/irismod/modules/rental/types"; +option (gogoproto.goproto_getters_all) = false; + +service Msg { + rpc SetUser(MsgSetUser) returns (MsgSetUserResponse) {} +} + +message MsgSetUser { + string class_id = 1; + string nft_id = 2; + string renter = 3; + uint64 expire = 4; + string sender = 5; +} + +message MsgSetUserResponse {} \ No newline at end of file From 996e71252235b4a0ec375276d1d710b91628f7d7 Mon Sep 17 00:00:00 2001 From: yuandu Date: Wed, 14 Dec 2022 18:43:18 +0800 Subject: [PATCH 03/20] add rental module framework --- modules/rental/handler.go | 1 + modules/rental/keeper/genesis.go | 21 ++++ modules/rental/keeper/grpc_query.go | 20 +++ modules/rental/keeper/keeper.go | 20 +++ modules/rental/keeper/msg_server.go | 15 +++ modules/rental/module/module.go | 152 +++++++++++++++++++++++ modules/rental/types/codec.go | 28 +++++ modules/rental/types/errors.go | 8 ++ modules/rental/types/events.go | 11 ++ modules/rental/types/expected_keepers.go | 1 + modules/rental/types/genesis.go | 37 ++++++ modules/rental/types/key.go | 15 +++ modules/rental/types/msgs.go | 40 ++++++ modules/rental/types/rental.go | 1 + 14 files changed, 370 insertions(+) create mode 100644 modules/rental/handler.go create mode 100644 modules/rental/keeper/genesis.go create mode 100644 modules/rental/keeper/grpc_query.go create mode 100644 modules/rental/keeper/keeper.go create mode 100644 modules/rental/keeper/msg_server.go create mode 100644 modules/rental/module/module.go create mode 100644 modules/rental/types/codec.go create mode 100644 modules/rental/types/errors.go create mode 100644 modules/rental/types/events.go create mode 100644 modules/rental/types/expected_keepers.go create mode 100644 modules/rental/types/genesis.go create mode 100644 modules/rental/types/key.go create mode 100644 modules/rental/types/msgs.go create mode 100644 modules/rental/types/rental.go diff --git a/modules/rental/handler.go b/modules/rental/handler.go new file mode 100644 index 00000000..bdf45227 --- /dev/null +++ b/modules/rental/handler.go @@ -0,0 +1 @@ +package rental diff --git a/modules/rental/keeper/genesis.go b/modules/rental/keeper/genesis.go new file mode 100644 index 00000000..e4e3447f --- /dev/null +++ b/modules/rental/keeper/genesis.go @@ -0,0 +1,21 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/irisnet/irismod/modules/rental/types" +) + +// InitGenesis stores the NFT genesis. +func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) { + // todo: genesis validation + + // todo: set rental infos + panic("Fixme") +} + +// ExportGenesis returns a GenesisState for a given context and keeper. +func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { + // fixme + panic("Fixme") +} diff --git a/modules/rental/keeper/grpc_query.go b/modules/rental/keeper/grpc_query.go new file mode 100644 index 00000000..d172f87f --- /dev/null +++ b/modules/rental/keeper/grpc_query.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "context" + + "github.com/irisnet/irismod/modules/rental/types" +) + +var _ types.QueryServer = Keeper{} + +func (k Keeper) UserOf(context.Context, *types.MsgUserOfRequest) (*types.MsgUserOfResponse, error) { + panic("Fixme") +} +func (k Keeper) UserExpires(context.Context, *types.MsgUserExpiresRequest) (*types.MsgUserExpiresResponse, error) { + panic("Fixme") +} + +func (k Keeper) HaveUser(context.Context, *types.MsgHaveUserRequest) (*types.MsgHaveUserResponse, error) { + panic("Fixme") +} diff --git a/modules/rental/keeper/keeper.go b/modules/rental/keeper/keeper.go new file mode 100644 index 00000000..257808ca --- /dev/null +++ b/modules/rental/keeper/keeper.go @@ -0,0 +1,20 @@ +package keeper + +import ( + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" +) + +type Keeper struct { + storeKey storetypes.StoreKey + cdc codec.Codec + // fixme: necessary? nk nftkeeper.Keeper +} + +// NewKeeper creates a new instance of rental keeper +func NewKeeper(cdc codec.Codec, storeKey storetypes.StoreKey) Keeper { + return Keeper{ + storeKey: storeKey, + cdc: cdc, + } +} diff --git a/modules/rental/keeper/msg_server.go b/modules/rental/keeper/msg_server.go new file mode 100644 index 00000000..fb53cbee --- /dev/null +++ b/modules/rental/keeper/msg_server.go @@ -0,0 +1,15 @@ +package keeper + +import ( + "context" + + "github.com/irisnet/irismod/modules/rental/types" +) + +var _ types.MsgServer = Keeper{} + +func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.MsgSetUserResponse, error) { + // todo: set user + // todo: event + return &types.MsgSetUserResponse{}, nil +} diff --git a/modules/rental/module/module.go b/modules/rental/module/module.go new file mode 100644 index 00000000..7ad7814c --- /dev/null +++ b/modules/rental/module/module.go @@ -0,0 +1,152 @@ +package module + +import ( + "encoding/json" + "math/rand" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + abci "github.com/tendermint/tendermint/abci/types" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/irisnet/irismod/modules/rental/keeper" +) + +var ( + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModuleSimulation = AppModule{} +) + +// AppModuleBasic defines the basic application module used by the rental module. +type AppModuleBasic struct { + cdc codec.Codec +} + +// Name returns the Rental module's name. +func (AppModuleBasic) Name() string { panic("Fixme!") } + +// RegisterLegacyAminoCodec registers the rental module's types on the LegacyAmino codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + // fixme + panic("Fixme!") + //types.RegisterLegacyAminoCodec(cdc) +} + +// DefaultGenesis returns default genesis state as raw bytes for the rental module. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + // fixme + panic("Fixme!") + //return cdc.MustMarshalJSON(types.d) +} + +// ValidateGenesis performs genesis state validation for the rental module. +func (AppModuleBasic) ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error { + panic("Fixme!") +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the rental module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(client.Context, *runtime.ServeMux) { + panic("Fixme!") +} + +// GetTxCmd returns the root tx command for the rental module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + panic("Fixme!") +} + +// GetQueryCmd returns the root query command for the rental module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + panic("Fixme!") +} + +// RegisterInterfaces registers interfaces and implementations of the rental module. +func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + panic("Fixme!") +} + +// AppModule implements an application module for the rental module +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper + // fixme: add keeper +} + +// NewAppModule creates a new AppModule object +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { + panic("Fixme!") +} + +// Name returns the rental module's name. +func (AppModule) Name() string { panic("Fixme!") } + +// RegisterInvariants registers the rental module invariants. +func (AppModule) RegisterInvariants(sdk.InvariantRegistry) { + panic("Fixme!") +} + +// Deprecated: Route returns the message routing key for the rental module. +func (AppModule) Route() sdk.Route { + return sdk.Route{} +} + +// QuerierRoute returns the rental module's querier route name. +func (AppModule) QuerierRoute() string { + panic("Fixme!") +} + +// LegacyQuerierHandler returns the rental module sdk.Querier. +func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { + panic("Fixme!") +} + +// RegisterServices registers module services. +func (AppModule) RegisterServices(cfg module.Configurator) { + panic("Fixme!") +} + +// InitGenesis performs genesis initialization for the rental module. It returns +// no validator updates. +func (AppModule) InitGenesis(sdk.Context, codec.JSONCodec, json.RawMessage) []abci.ValidatorUpdate { + panic("Fixme!") +} + +// ExportGenesis returns the exported genesis state as raw bytes for the NFT module. +func (AppModule) ExportGenesis(sdk.Context, codec.JSONCodec) json.RawMessage { + panic("Fixme!") +} + +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return 1 } + +// AppModuleSimulation function + +// GenerateGenesisState creates a randomized GenState of the rental module. +func (AppModule) GenerateGenesisState(input *module.SimulationState) { + panic("Fixme!") +} + +// content functions used to simulate governance proposals +func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { + panic("Fixme!") +} + +// randomized module parameters for param change proposals +func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { + panic("Fixme!") +} + +// register a func to decode the each module's defined types from their corresponding store key +func (AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} + +// simulation operations (i.e msgs) with their respective weight +func (AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + panic("Fixme!") +} diff --git a/modules/rental/types/codec.go b/modules/rental/types/codec.go new file mode 100644 index 00000000..27753c49 --- /dev/null +++ b/modules/rental/types/codec.go @@ -0,0 +1,28 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/types" + cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" +) + +var ( + amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewAminoCodec(amino) +) + +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + // fixme + panic("Fixme!") +} + +func RegisterInterfaces(registry types.InterfaceRegistry) { + // fixme + panic("Fixme!") +} + +func init() { + RegisterLegacyAminoCodec(amino) + cryptocodec.RegisterCrypto(amino) + amino.Seal() +} diff --git a/modules/rental/types/errors.go b/modules/rental/types/errors.go new file mode 100644 index 00000000..6f52c17d --- /dev/null +++ b/modules/rental/types/errors.go @@ -0,0 +1,8 @@ +package types + +import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + +var ( + // fixme + ErrInvalidRentalInfos = sdkerrors.Register(ModuleName, 1, "invalid rental infos") +) diff --git a/modules/rental/types/events.go b/modules/rental/types/events.go new file mode 100644 index 00000000..6fc883d7 --- /dev/null +++ b/modules/rental/types/events.go @@ -0,0 +1,11 @@ +package types + +// rental module event types +var ( + // fixme + EventTypeSetUser = "set_user" + + AttributeValueCategory = ModuleName + + AttributeKeySender = "sender" +) diff --git a/modules/rental/types/expected_keepers.go b/modules/rental/types/expected_keepers.go new file mode 100644 index 00000000..ab1254f4 --- /dev/null +++ b/modules/rental/types/expected_keepers.go @@ -0,0 +1 @@ +package types diff --git a/modules/rental/types/genesis.go b/modules/rental/types/genesis.go new file mode 100644 index 00000000..57a699a4 --- /dev/null +++ b/modules/rental/types/genesis.go @@ -0,0 +1,37 @@ +package types + +import ( + "encoding/json" + + "github.com/cosmos/cosmos-sdk/codec" +) + +// Validate performs basic validation of supply genesis data returning an +// error for any failed validation criteria. +func (gs GenesisState) Validate() error { + // Fixme! + panic("Fixme!") +} + +// NewGenesisState creates a new genesis state. +func NewGenesisState(renterInfos []RentalInfo) *GenesisState { + return &GenesisState{ + RenterInfos: renterInfos, + } +} + +// DefaultGenesisState returns a default rental module genesis state. +func DefaultGenesisState() *GenesisState { + return NewGenesisState([]RentalInfo{}) +} + +// GetGenesisStateFromAppState returns rental GenesisState given raw application genesis state. +func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState { + var genesisState GenesisState + + if appState[ModuleName] != nil { + cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) + } + + return &genesisState +} diff --git a/modules/rental/types/key.go b/modules/rental/types/key.go new file mode 100644 index 00000000..f3f95d1c --- /dev/null +++ b/modules/rental/types/key.go @@ -0,0 +1,15 @@ +package types + +const ( + // ModuleName defines the module name + ModuleName = "rental" + + // StoreKey defines the primary module store key + StoreKey = ModuleName + + // RouterKey defines the module's message routing key + RouterKey = ModuleName + + // QuerierRoute defines the module's query routing key + QuerierRoute = ModuleName +) diff --git a/modules/rental/types/msgs.go b/modules/rental/types/msgs.go new file mode 100644 index 00000000..c3c58d86 --- /dev/null +++ b/modules/rental/types/msgs.go @@ -0,0 +1,40 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + TypeMsgSetUser = "set_user" +) + +var ( + _ sdk.Msg = &MsgSetUser{} +) + +func NewMsgSetUser(classId, nftId, renter string, + expire uint64, sender string) *MsgSetUser { + return &MsgSetUser{ + ClassId: classId, + NftId: nftId, + Renter: renter, + Expire: expire, + Sender: sender, + } +} + +func (MsgSetUser) Route() string { return RouterKey } + +func (MsgSetUser) Type() string { return TypeMsgSetUser } + +func (MsgSetUser) ValidateBasic() error { + panic("Fixme") +} + +func (MsgSetUser) GetSignBytes() []byte { + panic("Fixme") +} + +func (MsgSetUser) GetSigners() []sdk.AccAddress { + panic("Fixme") +} diff --git a/modules/rental/types/rental.go b/modules/rental/types/rental.go new file mode 100644 index 00000000..ab1254f4 --- /dev/null +++ b/modules/rental/types/rental.go @@ -0,0 +1 @@ +package types From d0a5a3b4cbc2fe6938f8aa6974a924139b6fe3f2 Mon Sep 17 00:00:00 2001 From: yuandu Date: Thu, 15 Dec 2022 11:25:05 +0800 Subject: [PATCH 04/20] fix rental module --- modules/rental/client/cli/query.go | 8 ++ modules/rental/client/cli/tx.go | 8 ++ modules/rental/handler.go | 1 - modules/rental/keeper/genesis.go | 2 +- modules/rental/keeper/keys.go | 7 ++ modules/rental/module/module.go | 106 ++++++++++++++---------- modules/rental/simulation/decoder.go | 12 +++ modules/rental/simulation/genesis.go | 8 ++ modules/rental/simulation/operations.go | 20 +++++ modules/rental/types/genesis.go | 5 ++ 10 files changed, 133 insertions(+), 44 deletions(-) create mode 100644 modules/rental/client/cli/query.go create mode 100644 modules/rental/client/cli/tx.go delete mode 100644 modules/rental/handler.go create mode 100644 modules/rental/keeper/keys.go create mode 100644 modules/rental/simulation/decoder.go create mode 100644 modules/rental/simulation/genesis.go create mode 100644 modules/rental/simulation/operations.go diff --git a/modules/rental/client/cli/query.go b/modules/rental/client/cli/query.go new file mode 100644 index 00000000..ed61050b --- /dev/null +++ b/modules/rental/client/cli/query.go @@ -0,0 +1,8 @@ +package cli + +import "github.com/spf13/cobra" + +func GetQueryCmd() *cobra.Command { + // fixme + panic("Fixme!") +} diff --git a/modules/rental/client/cli/tx.go b/modules/rental/client/cli/tx.go new file mode 100644 index 00000000..38d908fe --- /dev/null +++ b/modules/rental/client/cli/tx.go @@ -0,0 +1,8 @@ +package cli + +import "github.com/spf13/cobra" + +func GetTxCmd() *cobra.Command { + // fixme + panic("Fixme!") +} diff --git a/modules/rental/handler.go b/modules/rental/handler.go deleted file mode 100644 index bdf45227..00000000 --- a/modules/rental/handler.go +++ /dev/null @@ -1 +0,0 @@ -package rental diff --git a/modules/rental/keeper/genesis.go b/modules/rental/keeper/genesis.go index e4e3447f..d895f217 100644 --- a/modules/rental/keeper/genesis.go +++ b/modules/rental/keeper/genesis.go @@ -7,7 +7,7 @@ import ( ) // InitGenesis stores the NFT genesis. -func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState) { +func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { // todo: genesis validation // todo: set rental infos diff --git a/modules/rental/keeper/keys.go b/modules/rental/keeper/keys.go new file mode 100644 index 00000000..5af6199e --- /dev/null +++ b/modules/rental/keeper/keys.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/irisnet/irismod/modules/rental/types" +) + +const StoreKey = types.ModuleName diff --git a/modules/rental/module/module.go b/modules/rental/module/module.go index 7ad7814c..1597bf8d 100644 --- a/modules/rental/module/module.go +++ b/modules/rental/module/module.go @@ -2,6 +2,10 @@ package module import ( "encoding/json" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/nft" + "github.com/irisnet/irismod/modules/rental/client/cli" + "github.com/irisnet/irismod/modules/rental/simulation" "math/rand" "github.com/grpc-ecosystem/grpc-gateway/runtime" @@ -10,12 +14,13 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/irisnet/irismod/modules/rental/keeper" + "github.com/irisnet/irismod/modules/rental/types" ) var ( @@ -30,66 +35,71 @@ type AppModuleBasic struct { } // Name returns the Rental module's name. -func (AppModuleBasic) Name() string { panic("Fixme!") } +func (AppModuleBasic) Name() string { return types.ModuleName } // RegisterLegacyAminoCodec registers the rental module's types on the LegacyAmino codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // fixme - panic("Fixme!") - //types.RegisterLegacyAminoCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) } // DefaultGenesis returns default genesis state as raw bytes for the rental module. func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - // fixme - panic("Fixme!") - //return cdc.MustMarshalJSON(types.d) + return cdc.MustMarshalJSON(types.DefaultGenesisState()) } // ValidateGenesis performs genesis state validation for the rental module. -func (AppModuleBasic) ValidateGenesis(codec.JSONCodec, client.TxEncodingConfig, json.RawMessage) error { - panic("Fixme!") +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genesisState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { + return sdkerrors.Wrapf(err, "failed to unmarshal %s genesis state", nft.ModuleName) + } + + return types.ValidateGenesis(genesisState) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the rental module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(client.Context, *runtime.ServeMux) { +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { + // fixme: add gw proto panic("Fixme!") } // GetTxCmd returns the root tx command for the rental module. func (AppModuleBasic) GetTxCmd() *cobra.Command { - panic("Fixme!") + return cli.GetTxCmd() } // GetQueryCmd returns the root query command for the rental module. func (AppModuleBasic) GetQueryCmd() *cobra.Command { - panic("Fixme!") + return cli.GetQueryCmd() } // RegisterInterfaces registers interfaces and implementations of the rental module. -func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { - panic("Fixme!") +func (AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(registry) } // AppModule implements an application module for the rental module type AppModule struct { AppModuleBasic - keeper keeper.Keeper - // fixme: add keeper + keeper keeper.Keeper + registry cdctypes.InterfaceRegistry } // NewAppModule creates a new AppModule object func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { - panic("Fixme!") + return AppModule{ + AppModuleBasic: AppModuleBasic{cdc: cdc}, + keeper: keeper, + } } // Name returns the rental module's name. -func (AppModule) Name() string { panic("Fixme!") } +func (AppModule) Name() string { return types.ModuleName } // RegisterInvariants registers the rental module invariants. -func (AppModule) RegisterInvariants(sdk.InvariantRegistry) { - panic("Fixme!") +// NOTE: there's no invariants to enforce +func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) { } // Deprecated: Route returns the message routing key for the rental module. @@ -99,28 +109,34 @@ func (AppModule) Route() sdk.Route { // QuerierRoute returns the rental module's querier route name. func (AppModule) QuerierRoute() string { - panic("Fixme!") + return "" } // LegacyQuerierHandler returns the rental module sdk.Querier. func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { - panic("Fixme!") + return nil } -// RegisterServices registers module services. -func (AppModule) RegisterServices(cfg module.Configurator) { - panic("Fixme!") +// RegisterServices registers module gRPC services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), am.keeper) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) } // InitGenesis performs genesis initialization for the rental module. It returns // no validator updates. -func (AppModule) InitGenesis(sdk.Context, codec.JSONCodec, json.RawMessage) []abci.ValidatorUpdate { - panic("Fixme!") +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) []abci.ValidatorUpdate { + var genesisState types.GenesisState + cdc.MustUnmarshalJSON(bz, &genesisState) + am.keeper.InitGenesis(ctx, &genesisState) + + return []abci.ValidatorUpdate{} } -// ExportGenesis returns the exported genesis state as raw bytes for the NFT module. -func (AppModule) ExportGenesis(sdk.Context, codec.JSONCodec) json.RawMessage { - panic("Fixme!") +// ExportGenesis returns the exported genesis state as raw bytes for the rental module. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + gs := am.keeper.ExportGenesis(ctx) + return cdc.MustMarshalJSON(gs) } // ConsensusVersion implements AppModule/ConsensusVersion. @@ -129,24 +145,30 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } // AppModuleSimulation function // GenerateGenesisState creates a randomized GenState of the rental module. -func (AppModule) GenerateGenesisState(input *module.SimulationState) { - panic("Fixme!") +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + simulation.RandomizedGenState(simState) } -// content functions used to simulate governance proposals +// ProposalContents is used to simulate governance proposals func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { - panic("Fixme!") + return nil } -// randomized module parameters for param change proposals +// RandomizedParams generates randomized module parameters for param change proposals func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - panic("Fixme!") + return nil } -// register a func to decode the each module's defined types from their corresponding store key -func (AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} +// RegisterStoreDecoder registers a func to decode the each module's defined types from their corresponding store key +func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { + sdr[keeper.StoreKey] = simulation.NewDecodeStore(am.cdc) +} -// simulation operations (i.e msgs) with their respective weight -func (AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - panic("Fixme!") +// WeightedOperations sets simulation operations with their respective weight +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + return simulation.WeightedOperations( + am.registry, + simState.AppParams, simState.Cdc, + am.keeper, + ) } diff --git a/modules/rental/simulation/decoder.go b/modules/rental/simulation/decoder.go new file mode 100644 index 00000000..2472ac5a --- /dev/null +++ b/modules/rental/simulation/decoder.go @@ -0,0 +1,12 @@ +package simulation + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/types/kv" +) + +// NewDecodeStore returns a decoder function closure that unmarshals the KVPair's +// Value to the corresponding rental type. +func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { + panic("Fixme!") +} diff --git a/modules/rental/simulation/genesis.go b/modules/rental/simulation/genesis.go new file mode 100644 index 00000000..3abe4921 --- /dev/null +++ b/modules/rental/simulation/genesis.go @@ -0,0 +1,8 @@ +package simulation + +import "github.com/cosmos/cosmos-sdk/types/module" + +func RandomizedGenState(simState *module.SimulationState) { + // fixme + panic("Fixme!") +} diff --git a/modules/rental/simulation/operations.go b/modules/rental/simulation/operations.go new file mode 100644 index 00000000..2d10604b --- /dev/null +++ b/modules/rental/simulation/operations.go @@ -0,0 +1,20 @@ +package simulation + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/irisnet/irismod/modules/rental/keeper" +) + +// WeightedOperations returns all the operations from the module with their respective weights +func WeightedOperations( + registry cdctypes.InterfaceRegistry, + appParams simtypes.AppParams, + cdc codec.JSONCodec, + k keeper.Keeper, +) simulation.WeightedOperations { + panic("Fixme") +} diff --git a/modules/rental/types/genesis.go b/modules/rental/types/genesis.go index 57a699a4..14046a3b 100644 --- a/modules/rental/types/genesis.go +++ b/modules/rental/types/genesis.go @@ -35,3 +35,8 @@ func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.R return &genesisState } + +// ValidateGenesis check the given genesis state has no integrity issues +func ValidateGenesis(data GenesisState) error { + panic("Fixme!") +} From 17b1f46209da62893e43ab342d64b0b09aac17cf Mon Sep 17 00:00:00 2001 From: yuandu Date: Thu, 15 Dec 2022 12:17:54 +0800 Subject: [PATCH 05/20] fix proto --- modules/rental/keeper/grpc_query.go | 6 +- modules/rental/module/module.go | 6 +- modules/rental/types/genesis.pb.go | 22 +- modules/rental/types/query.pb.go | 439 +++++++++++++------------- modules/rental/types/query.pb.gw.go | 457 ++++++++++++++++++++++++++++ modules/rental/types/rental.pb.go | 49 +-- modules/rental/types/tx.pb.go | 4 + proto/rental/genesis.proto | 2 +- proto/rental/query.proto | 41 ++- proto/rental/rental.proto | 4 +- proto/rental/tx.proto | 4 + 11 files changed, 780 insertions(+), 254 deletions(-) create mode 100644 modules/rental/types/query.pb.gw.go diff --git a/modules/rental/keeper/grpc_query.go b/modules/rental/keeper/grpc_query.go index d172f87f..3969bdfb 100644 --- a/modules/rental/keeper/grpc_query.go +++ b/modules/rental/keeper/grpc_query.go @@ -8,13 +8,13 @@ import ( var _ types.QueryServer = Keeper{} -func (k Keeper) UserOf(context.Context, *types.MsgUserOfRequest) (*types.MsgUserOfResponse, error) { +func (k Keeper) User(context.Context, *types.QueryUserRequest) (*types.QueryUserResponse, error) { panic("Fixme") } -func (k Keeper) UserExpires(context.Context, *types.MsgUserExpiresRequest) (*types.MsgUserExpiresResponse, error) { +func (k Keeper) Expires(context.Context, *types.QueryExpiresRequest) (*types.QueryExpiresResponse, error) { panic("Fixme") } -func (k Keeper) HaveUser(context.Context, *types.MsgHaveUserRequest) (*types.MsgHaveUserResponse, error) { +func (k Keeper) HasUser(context.Context, *types.QueryHasUserRequest) (*types.QueryHasUserResponse, error) { panic("Fixme") } diff --git a/modules/rental/module/module.go b/modules/rental/module/module.go index 1597bf8d..a6e952aa 100644 --- a/modules/rental/module/module.go +++ b/modules/rental/module/module.go @@ -1,6 +1,7 @@ package module import ( + "context" "encoding/json" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/nft" @@ -59,8 +60,9 @@ func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncod // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the rental module. func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - // fixme: add gw proto - panic("Fixme!") + if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // GetTxCmd returns the root tx command for the rental module. diff --git a/modules/rental/types/genesis.pb.go b/modules/rental/types/genesis.pb.go index fe520d61..1bb125b6 100644 --- a/modules/rental/types/genesis.pb.go +++ b/modules/rental/types/genesis.pb.go @@ -23,6 +23,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// GenesisState defines the rental module's genesis state type GenesisState struct { RenterInfos []RentalInfo `protobuf:"bytes,1,rep,name=renterInfos,proto3" json:"renterInfos"` } @@ -60,6 +61,13 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo +func (m *GenesisState) GetRenterInfos() []RentalInfo { + if m != nil { + return m.RenterInfos + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "irismod.rental.GenesisState") } @@ -67,7 +75,7 @@ func init() { func init() { proto.RegisterFile("rental/genesis.proto", fileDescriptor_2f80438895461b63) } var fileDescriptor_2f80438895461b63 = []byte{ - // 204 bytes of a gzipped FileDescriptorProto + // 200 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4a, 0xcd, 0x2b, 0x49, 0xcc, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcb, 0x2c, 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0xc8, 0x4a, 0x89, 0xa4, 0xe7, @@ -75,12 +83,12 @@ var fileDescriptor_2f80438895461b63 = []byte{ 0x54, 0x0a, 0xe2, 0xe2, 0x71, 0x87, 0x98, 0x15, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0xe4, 0xc4, 0xc5, 0x0d, 0x92, 0x4f, 0x2d, 0xf2, 0xcc, 0x4b, 0xcb, 0x2f, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, 0x92, 0xd2, 0x43, 0xb5, 0x40, 0x2f, 0x08, 0x4c, 0x81, 0x94, 0x38, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, - 0x10, 0x84, 0xac, 0xc9, 0xc9, 0xf7, 0xc4, 0x43, 0x39, 0x86, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, - 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, - 0x3c, 0x96, 0x63, 0x88, 0xd2, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, - 0x07, 0x19, 0x9b, 0x97, 0x5a, 0xa2, 0x0f, 0x35, 0x5e, 0x3f, 0x37, 0x3f, 0xa5, 0x34, 0x27, 0xb5, - 0x18, 0xea, 0x44, 0xfd, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x4b, 0x8d, 0x01, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x32, 0x8d, 0x8a, 0x7d, 0xfc, 0x00, 0x00, 0x00, + 0x10, 0x84, 0xac, 0xc9, 0xc9, 0xf3, 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, + 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x46, 0xe6, 0xa5, + 0x96, 0xe8, 0x43, 0x8d, 0xd6, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x2d, 0x86, 0x3a, 0x4f, 0xbf, + 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x4a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, + 0x68, 0x5f, 0x5f, 0x65, 0xf8, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/modules/rental/types/query.pb.go b/modules/rental/types/query.pb.go index d9962c91..72677b06 100644 --- a/modules/rental/types/query.pb.go +++ b/modules/rental/types/query.pb.go @@ -9,6 +9,7 @@ import ( _ "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" @@ -28,23 +29,24 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MsgUserOfRequest struct { +// QueryUserRequest is the request type for the Query/Renter RPC method +type QueryUserRequest struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` } -func (m *MsgUserOfRequest) Reset() { *m = MsgUserOfRequest{} } -func (m *MsgUserOfRequest) String() string { return proto.CompactTextString(m) } -func (*MsgUserOfRequest) ProtoMessage() {} -func (*MsgUserOfRequest) Descriptor() ([]byte, []int) { +func (m *QueryUserRequest) Reset() { *m = QueryUserRequest{} } +func (m *QueryUserRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUserRequest) ProtoMessage() {} +func (*QueryUserRequest) Descriptor() ([]byte, []int) { return fileDescriptor_716e6efac23cde5d, []int{0} } -func (m *MsgUserOfRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryUserRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUserOfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUserOfRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryUserRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -54,34 +56,35 @@ func (m *MsgUserOfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *MsgUserOfRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUserOfRequest.Merge(m, src) +func (m *QueryUserRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserRequest.Merge(m, src) } -func (m *MsgUserOfRequest) XXX_Size() int { +func (m *QueryUserRequest) XXX_Size() int { return m.Size() } -func (m *MsgUserOfRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUserOfRequest.DiscardUnknown(m) +func (m *QueryUserRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserRequest.DiscardUnknown(m) } -var xxx_messageInfo_MsgUserOfRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryUserRequest proto.InternalMessageInfo -type MsgUserOfResponse struct { - Renter string `protobuf:"bytes,1,opt,name=renter,proto3" json:"renter,omitempty"` +// QueryUserResponse is the response type for the Query/Renter RPC method +type QueryUserResponse struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` } -func (m *MsgUserOfResponse) Reset() { *m = MsgUserOfResponse{} } -func (m *MsgUserOfResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUserOfResponse) ProtoMessage() {} -func (*MsgUserOfResponse) Descriptor() ([]byte, []int) { +func (m *QueryUserResponse) Reset() { *m = QueryUserResponse{} } +func (m *QueryUserResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUserResponse) ProtoMessage() {} +func (*QueryUserResponse) Descriptor() ([]byte, []int) { return fileDescriptor_716e6efac23cde5d, []int{1} } -func (m *MsgUserOfResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryUserResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUserOfResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUserOfResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryUserResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -91,35 +94,36 @@ func (m *MsgUserOfResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *MsgUserOfResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUserOfResponse.Merge(m, src) +func (m *QueryUserResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserResponse.Merge(m, src) } -func (m *MsgUserOfResponse) XXX_Size() int { +func (m *QueryUserResponse) XXX_Size() int { return m.Size() } -func (m *MsgUserOfResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUserOfResponse.DiscardUnknown(m) +func (m *QueryUserResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUserOfResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryUserResponse proto.InternalMessageInfo -type MsgUserExpiresRequest struct { +// QueryExpiresRequest is the request type for the Query/Expires RPC method +type QueryExpiresRequest struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` } -func (m *MsgUserExpiresRequest) Reset() { *m = MsgUserExpiresRequest{} } -func (m *MsgUserExpiresRequest) String() string { return proto.CompactTextString(m) } -func (*MsgUserExpiresRequest) ProtoMessage() {} -func (*MsgUserExpiresRequest) Descriptor() ([]byte, []int) { +func (m *QueryExpiresRequest) Reset() { *m = QueryExpiresRequest{} } +func (m *QueryExpiresRequest) String() string { return proto.CompactTextString(m) } +func (*QueryExpiresRequest) ProtoMessage() {} +func (*QueryExpiresRequest) Descriptor() ([]byte, []int) { return fileDescriptor_716e6efac23cde5d, []int{2} } -func (m *MsgUserExpiresRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryExpiresRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUserExpiresRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryExpiresRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUserExpiresRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryExpiresRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -129,34 +133,35 @@ func (m *MsgUserExpiresRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *MsgUserExpiresRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUserExpiresRequest.Merge(m, src) +func (m *QueryExpiresRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryExpiresRequest.Merge(m, src) } -func (m *MsgUserExpiresRequest) XXX_Size() int { +func (m *QueryExpiresRequest) XXX_Size() int { return m.Size() } -func (m *MsgUserExpiresRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUserExpiresRequest.DiscardUnknown(m) +func (m *QueryExpiresRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryExpiresRequest.DiscardUnknown(m) } -var xxx_messageInfo_MsgUserExpiresRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryExpiresRequest proto.InternalMessageInfo -type MsgUserExpiresResponse struct { +// QueryExpiresResponse is the response type for the Query/Expires RPC method +type QueryExpiresResponse struct { Expires uint64 `protobuf:"varint,1,opt,name=expires,proto3" json:"expires,omitempty"` } -func (m *MsgUserExpiresResponse) Reset() { *m = MsgUserExpiresResponse{} } -func (m *MsgUserExpiresResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUserExpiresResponse) ProtoMessage() {} -func (*MsgUserExpiresResponse) Descriptor() ([]byte, []int) { +func (m *QueryExpiresResponse) Reset() { *m = QueryExpiresResponse{} } +func (m *QueryExpiresResponse) String() string { return proto.CompactTextString(m) } +func (*QueryExpiresResponse) ProtoMessage() {} +func (*QueryExpiresResponse) Descriptor() ([]byte, []int) { return fileDescriptor_716e6efac23cde5d, []int{3} } -func (m *MsgUserExpiresResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryExpiresResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUserExpiresResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryExpiresResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUserExpiresResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryExpiresResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -166,35 +171,36 @@ func (m *MsgUserExpiresResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *MsgUserExpiresResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUserExpiresResponse.Merge(m, src) +func (m *QueryExpiresResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryExpiresResponse.Merge(m, src) } -func (m *MsgUserExpiresResponse) XXX_Size() int { +func (m *QueryExpiresResponse) XXX_Size() int { return m.Size() } -func (m *MsgUserExpiresResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUserExpiresResponse.DiscardUnknown(m) +func (m *QueryExpiresResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryExpiresResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUserExpiresResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryExpiresResponse proto.InternalMessageInfo -type MsgHaveUserRequest struct { +// QueryHasUserRequest is the request type for the Query/HasUser RPC method +type QueryHasUserRequest struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` } -func (m *MsgHaveUserRequest) Reset() { *m = MsgHaveUserRequest{} } -func (m *MsgHaveUserRequest) String() string { return proto.CompactTextString(m) } -func (*MsgHaveUserRequest) ProtoMessage() {} -func (*MsgHaveUserRequest) Descriptor() ([]byte, []int) { +func (m *QueryHasUserRequest) Reset() { *m = QueryHasUserRequest{} } +func (m *QueryHasUserRequest) String() string { return proto.CompactTextString(m) } +func (*QueryHasUserRequest) ProtoMessage() {} +func (*QueryHasUserRequest) Descriptor() ([]byte, []int) { return fileDescriptor_716e6efac23cde5d, []int{4} } -func (m *MsgHaveUserRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryHasUserRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgHaveUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryHasUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgHaveUserRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryHasUserRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -204,34 +210,35 @@ func (m *MsgHaveUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgHaveUserRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgHaveUserRequest.Merge(m, src) +func (m *QueryHasUserRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHasUserRequest.Merge(m, src) } -func (m *MsgHaveUserRequest) XXX_Size() int { +func (m *QueryHasUserRequest) XXX_Size() int { return m.Size() } -func (m *MsgHaveUserRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MsgHaveUserRequest.DiscardUnknown(m) +func (m *QueryHasUserRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHasUserRequest.DiscardUnknown(m) } -var xxx_messageInfo_MsgHaveUserRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryHasUserRequest proto.InternalMessageInfo -type MsgHaveUserResponse struct { - HadRenter bool `protobuf:"varint,1,opt,name=had_renter,json=hadRenter,proto3" json:"had_renter,omitempty"` +// QueryHasUserResponse is the response type for the Query/HasUser RPC method +type QueryHasUserResponse struct { + HasUser bool `protobuf:"varint,1,opt,name=has_user,json=hasUser,proto3" json:"has_user,omitempty"` } -func (m *MsgHaveUserResponse) Reset() { *m = MsgHaveUserResponse{} } -func (m *MsgHaveUserResponse) String() string { return proto.CompactTextString(m) } -func (*MsgHaveUserResponse) ProtoMessage() {} -func (*MsgHaveUserResponse) Descriptor() ([]byte, []int) { +func (m *QueryHasUserResponse) Reset() { *m = QueryHasUserResponse{} } +func (m *QueryHasUserResponse) String() string { return proto.CompactTextString(m) } +func (*QueryHasUserResponse) ProtoMessage() {} +func (*QueryHasUserResponse) Descriptor() ([]byte, []int) { return fileDescriptor_716e6efac23cde5d, []int{5} } -func (m *MsgHaveUserResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryHasUserResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgHaveUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryHasUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgHaveUserResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryHasUserResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -241,55 +248,59 @@ func (m *MsgHaveUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgHaveUserResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgHaveUserResponse.Merge(m, src) +func (m *QueryHasUserResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHasUserResponse.Merge(m, src) } -func (m *MsgHaveUserResponse) XXX_Size() int { +func (m *QueryHasUserResponse) XXX_Size() int { return m.Size() } -func (m *MsgHaveUserResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgHaveUserResponse.DiscardUnknown(m) +func (m *QueryHasUserResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHasUserResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgHaveUserResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryHasUserResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgUserOfRequest)(nil), "irismod.rental.MsgUserOfRequest") - proto.RegisterType((*MsgUserOfResponse)(nil), "irismod.rental.MsgUserOfResponse") - proto.RegisterType((*MsgUserExpiresRequest)(nil), "irismod.rental.MsgUserExpiresRequest") - proto.RegisterType((*MsgUserExpiresResponse)(nil), "irismod.rental.MsgUserExpiresResponse") - proto.RegisterType((*MsgHaveUserRequest)(nil), "irismod.rental.MsgHaveUserRequest") - proto.RegisterType((*MsgHaveUserResponse)(nil), "irismod.rental.MsgHaveUserResponse") + proto.RegisterType((*QueryUserRequest)(nil), "irismod.rental.QueryUserRequest") + proto.RegisterType((*QueryUserResponse)(nil), "irismod.rental.QueryUserResponse") + proto.RegisterType((*QueryExpiresRequest)(nil), "irismod.rental.QueryExpiresRequest") + proto.RegisterType((*QueryExpiresResponse)(nil), "irismod.rental.QueryExpiresResponse") + proto.RegisterType((*QueryHasUserRequest)(nil), "irismod.rental.QueryHasUserRequest") + proto.RegisterType((*QueryHasUserResponse)(nil), "irismod.rental.QueryHasUserResponse") } func init() { proto.RegisterFile("rental/query.proto", fileDescriptor_716e6efac23cde5d) } var fileDescriptor_716e6efac23cde5d = []byte{ - // 370 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xc1, 0x4a, 0xeb, 0x40, - 0x14, 0x86, 0x93, 0x72, 0x9b, 0xb6, 0xe7, 0xc2, 0xe5, 0xde, 0xb9, 0xb6, 0xd4, 0x80, 0xa1, 0x46, - 0x14, 0x41, 0xc8, 0x40, 0xf5, 0x09, 0x44, 0xc5, 0x2e, 0x82, 0x18, 0x71, 0x23, 0x42, 0x49, 0x3b, - 0xd3, 0x34, 0xd0, 0x66, 0xd2, 0x99, 0x89, 0xd8, 0x47, 0x70, 0xe7, 0x63, 0x75, 0xd9, 0xa5,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5, 0xdb, 0x74, 0x4b, 0xc8, 0x05, 0x23, 0x0f, 0x0c, 0x35, 0x9c, 0xd5, - 0x55, 0x39, 0xeb, 0x1b, 0x31, 0xf7, 0x37, 0x28, 0x94, 0xef, 0x23, 0xfc, 0x5e, 0xca, 0x01, 0x1d, - 0x7e, 0x33, 0xb1, 0x1a, 0xb9, 0x79, 0xf4, 0x93, 0x4c, 0xd1, 0xef, 0xa0, 0xbc, 0x78, 0x29, 0xb2, - 0xbf, 0x98, 0x59, 0x8b, 0xd3, 0x3c, 0xd8, 0xa8, 0xc9, 0xa1, 0xe7, 0xee, 0xe4, 0xc3, 0xd2, 0x26, - 0x33, 0x4b, 0x9f, 0xce, 0x2c, 0xfd, 0x7d, 0x66, 0xe9, 0xaf, 0x73, 0x4b, 0x9b, 0xce, 0x2d, 0xed, - 0x6d, 0x6e, 0x69, 0x0f, 0x38, 0x08, 0x65, 0x3f, 0xe9, 0x38, 0x5d, 0x36, 0xc4, 0x29, 0x2c, 0xa2, - 0x12, 0x2b, 0x28, 0x1e, 0x32, 0x92, 0x0c, 0xa8, 0xc0, 0xea, 0xdb, 0xcb, 0x71, 0x4c, 0x45, 0xc7, - 0xc8, 0x7e, 0xf4, 0xe9, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xde, 0x55, 0xc8, 0x39, 0x0d, 0x03, - 0x00, 0x00, + // 433 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x4f, 0x8f, 0xd2, 0x40, + 0x1c, 0x6d, 0x11, 0x28, 0xce, 0xc1, 0xe8, 0x88, 0x09, 0x34, 0xa6, 0xc1, 0x6a, 0x22, 0xf1, 0x4f, + 0x07, 0xc5, 0x4f, 0x60, 0x34, 0xca, 0xc1, 0x83, 0x4d, 0xbc, 0x78, 0x21, 0x85, 0x0e, 0xa5, 0x49, + 0x99, 0x29, 0x9d, 0x69, 0x22, 0x21,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, 0xd5, 0xbf, 0x09, 0x00, 0x00, 0xff, 0xff, 0xc6, 0xb7, 0x19, 0x48, 0xb7, 0x03, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -304,9 +315,10 @@ const _ = grpc.SupportPackageIsVersion4 // // 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 { - UserOf(ctx context.Context, in *MsgUserOfRequest, opts ...grpc.CallOption) (*MsgUserOfResponse, error) - UserExpires(ctx context.Context, in *MsgUserExpiresRequest, opts ...grpc.CallOption) (*MsgUserExpiresResponse, error) - HaveUser(ctx context.Context, in *MsgHaveUserRequest, opts ...grpc.CallOption) (*MsgHaveUserResponse, error) + // + User(ctx context.Context, in *QueryUserRequest, opts ...grpc.CallOption) (*QueryUserResponse, error) + Expires(ctx context.Context, in *QueryExpiresRequest, opts ...grpc.CallOption) (*QueryExpiresResponse, error) + HasUser(ctx context.Context, in *QueryHasUserRequest, opts ...grpc.CallOption) (*QueryHasUserResponse, error) } type queryClient struct { @@ -317,27 +329,27 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) UserOf(ctx context.Context, in *MsgUserOfRequest, opts ...grpc.CallOption) (*MsgUserOfResponse, error) { - out := new(MsgUserOfResponse) - err := c.cc.Invoke(ctx, "/irismod.rental.Query/UserOf", in, out, opts...) +func (c *queryClient) User(ctx context.Context, in *QueryUserRequest, opts ...grpc.CallOption) (*QueryUserResponse, error) { + out := new(QueryUserResponse) + err := c.cc.Invoke(ctx, "/irismod.rental.Query/User", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) UserExpires(ctx context.Context, in *MsgUserExpiresRequest, opts ...grpc.CallOption) (*MsgUserExpiresResponse, error) { - out := new(MsgUserExpiresResponse) - err := c.cc.Invoke(ctx, "/irismod.rental.Query/UserExpires", in, out, opts...) +func (c *queryClient) Expires(ctx context.Context, in *QueryExpiresRequest, opts ...grpc.CallOption) (*QueryExpiresResponse, error) { + out := new(QueryExpiresResponse) + err := c.cc.Invoke(ctx, "/irismod.rental.Query/Expires", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) HaveUser(ctx context.Context, in *MsgHaveUserRequest, opts ...grpc.CallOption) (*MsgHaveUserResponse, error) { - out := new(MsgHaveUserResponse) - err := c.cc.Invoke(ctx, "/irismod.rental.Query/HaveUser", in, out, opts...) +func (c *queryClient) HasUser(ctx context.Context, in *QueryHasUserRequest, opts ...grpc.CallOption) (*QueryHasUserResponse, error) { + out := new(QueryHasUserResponse) + err := c.cc.Invoke(ctx, "/irismod.rental.Query/HasUser", in, out, opts...) if err != nil { return nil, err } @@ -346,79 +358,80 @@ func (c *queryClient) HaveUser(ctx context.Context, in *MsgHaveUserRequest, opts // QueryServer is the server API for Query service. type QueryServer interface { - UserOf(context.Context, *MsgUserOfRequest) (*MsgUserOfResponse, error) - UserExpires(context.Context, *MsgUserExpiresRequest) (*MsgUserExpiresResponse, error) - HaveUser(context.Context, *MsgHaveUserRequest) (*MsgHaveUserResponse, error) + // + User(context.Context, *QueryUserRequest) (*QueryUserResponse, error) + Expires(context.Context, *QueryExpiresRequest) (*QueryExpiresResponse, error) + HasUser(context.Context, *QueryHasUserRequest) (*QueryHasUserResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) UserOf(ctx context.Context, req *MsgUserOfRequest) (*MsgUserOfResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserOf not implemented") +func (*UnimplementedQueryServer) User(ctx context.Context, req *QueryUserRequest) (*QueryUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method User not implemented") } -func (*UnimplementedQueryServer) UserExpires(ctx context.Context, req *MsgUserExpiresRequest) (*MsgUserExpiresResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UserExpires not implemented") +func (*UnimplementedQueryServer) Expires(ctx context.Context, req *QueryExpiresRequest) (*QueryExpiresResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Expires not implemented") } -func (*UnimplementedQueryServer) HaveUser(ctx context.Context, req *MsgHaveUserRequest) (*MsgHaveUserResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HaveUser not implemented") +func (*UnimplementedQueryServer) HasUser(ctx context.Context, req *QueryHasUserRequest) (*QueryHasUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HasUser not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_UserOf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUserOfRequest) +func _Query_User_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUserRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).UserOf(ctx, in) + return srv.(QueryServer).User(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.rental.Query/UserOf", + FullMethod: "/irismod.rental.Query/User", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).UserOf(ctx, req.(*MsgUserOfRequest)) + return srv.(QueryServer).User(ctx, req.(*QueryUserRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_UserExpires_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUserExpiresRequest) +func _Query_Expires_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryExpiresRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).UserExpires(ctx, in) + return srv.(QueryServer).Expires(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.rental.Query/UserExpires", + FullMethod: "/irismod.rental.Query/Expires", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).UserExpires(ctx, req.(*MsgUserExpiresRequest)) + return srv.(QueryServer).Expires(ctx, req.(*QueryExpiresRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_HaveUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgHaveUserRequest) +func _Query_HasUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHasUserRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).HaveUser(ctx, in) + return srv.(QueryServer).HasUser(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.rental.Query/HaveUser", + FullMethod: "/irismod.rental.Query/HasUser", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).HaveUser(ctx, req.(*MsgHaveUserRequest)) + return srv.(QueryServer).HasUser(ctx, req.(*QueryHasUserRequest)) } return interceptor(ctx, in, info, handler) } @@ -428,23 +441,23 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "UserOf", - Handler: _Query_UserOf_Handler, + MethodName: "User", + Handler: _Query_User_Handler, }, { - MethodName: "UserExpires", - Handler: _Query_UserExpires_Handler, + MethodName: "Expires", + Handler: _Query_Expires_Handler, }, { - MethodName: "HaveUser", - Handler: _Query_HaveUser_Handler, + MethodName: "HasUser", + Handler: _Query_HasUser_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "rental/query.proto", } -func (m *MsgUserOfRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryUserRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -454,12 +467,12 @@ func (m *MsgUserOfRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUserOfRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryUserRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUserOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -481,7 +494,7 @@ func (m *MsgUserOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUserOfResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryUserResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -491,27 +504,27 @@ func (m *MsgUserOfResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUserOfResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryUserResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUserOfResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Renter) > 0 { - i -= len(m.Renter) - copy(dAtA[i:], m.Renter) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Renter))) + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgUserExpiresRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryExpiresRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -521,12 +534,12 @@ func (m *MsgUserExpiresRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUserExpiresRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryExpiresRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUserExpiresRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryExpiresRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -548,7 +561,7 @@ func (m *MsgUserExpiresRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgUserExpiresResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryExpiresResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -558,12 +571,12 @@ func (m *MsgUserExpiresResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUserExpiresResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryExpiresResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUserExpiresResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryExpiresResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -576,7 +589,7 @@ func (m *MsgUserExpiresResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgHaveUserRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryHasUserRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -586,12 +599,12 @@ func (m *MsgHaveUserRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgHaveUserRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryHasUserRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgHaveUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryHasUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -613,7 +626,7 @@ func (m *MsgHaveUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgHaveUserResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryHasUserResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -623,19 +636,19 @@ func (m *MsgHaveUserResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgHaveUserResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryHasUserResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgHaveUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryHasUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.HadRenter { + if m.HasUser { i-- - if m.HadRenter { + if m.HasUser { dAtA[i] = 1 } else { dAtA[i] = 0 @@ -657,7 +670,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgUserOfRequest) Size() (n int) { +func (m *QueryUserRequest) Size() (n int) { if m == nil { return 0 } @@ -674,20 +687,20 @@ func (m *MsgUserOfRequest) Size() (n int) { return n } -func (m *MsgUserOfResponse) Size() (n int) { +func (m *QueryUserResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Renter) + l = len(m.User) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } return n } -func (m *MsgUserExpiresRequest) Size() (n int) { +func (m *QueryExpiresRequest) Size() (n int) { if m == nil { return 0 } @@ -704,7 +717,7 @@ func (m *MsgUserExpiresRequest) Size() (n int) { return n } -func (m *MsgUserExpiresResponse) Size() (n int) { +func (m *QueryExpiresResponse) Size() (n int) { if m == nil { return 0 } @@ -716,7 +729,7 @@ func (m *MsgUserExpiresResponse) Size() (n int) { return n } -func (m *MsgHaveUserRequest) Size() (n int) { +func (m *QueryHasUserRequest) Size() (n int) { if m == nil { return 0 } @@ -733,13 +746,13 @@ func (m *MsgHaveUserRequest) Size() (n int) { return n } -func (m *MsgHaveUserResponse) Size() (n int) { +func (m *QueryHasUserResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.HadRenter { + if m.HasUser { n += 2 } return n @@ -751,7 +764,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgUserOfRequest) Unmarshal(dAtA []byte) error { +func (m *QueryUserRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -774,10 +787,10 @@ func (m *MsgUserOfRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUserOfRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryUserRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUserOfRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryUserRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -865,7 +878,7 @@ func (m *MsgUserOfRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUserOfResponse) Unmarshal(dAtA []byte) error { +func (m *QueryUserResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -888,15 +901,15 @@ func (m *MsgUserOfResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUserOfResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryUserResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUserOfResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Renter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -924,7 +937,7 @@ func (m *MsgUserOfResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Renter = string(dAtA[iNdEx:postIndex]) + m.User = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -947,7 +960,7 @@ func (m *MsgUserOfResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUserExpiresRequest) Unmarshal(dAtA []byte) error { +func (m *QueryExpiresRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -970,10 +983,10 @@ func (m *MsgUserExpiresRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUserExpiresRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryExpiresRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUserExpiresRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryExpiresRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1061,7 +1074,7 @@ func (m *MsgUserExpiresRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUserExpiresResponse) Unmarshal(dAtA []byte) error { +func (m *QueryExpiresResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1084,10 +1097,10 @@ func (m *MsgUserExpiresResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUserExpiresResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryExpiresResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUserExpiresResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryExpiresResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1130,7 +1143,7 @@ func (m *MsgUserExpiresResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgHaveUserRequest) Unmarshal(dAtA []byte) error { +func (m *QueryHasUserRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1153,10 +1166,10 @@ func (m *MsgHaveUserRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgHaveUserRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryHasUserRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgHaveUserRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryHasUserRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -1244,7 +1257,7 @@ func (m *MsgHaveUserRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgHaveUserResponse) Unmarshal(dAtA []byte) error { +func (m *QueryHasUserResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1267,15 +1280,15 @@ func (m *MsgHaveUserResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgHaveUserResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryHasUserResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgHaveUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryHasUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HadRenter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field HasUser", wireType) } var v int for shift := uint(0); ; shift += 7 { @@ -1292,7 +1305,7 @@ func (m *MsgHaveUserResponse) Unmarshal(dAtA []byte) error { break } } - m.HadRenter = bool(v != 0) + m.HasUser = bool(v != 0) default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/modules/rental/types/query.pb.gw.go b/modules/rental/types/query.pb.gw.go new file mode 100644 index 00000000..14c428b8 --- /dev/null +++ b/modules/rental/types/query.pb.gw.go @@ -0,0 +1,457 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: rental/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +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 + +func request_Query_User_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := client.User(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_User_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := server.User(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_Expires_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryExpiresRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := client.Expires(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Expires_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryExpiresRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := server.Expires(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHasUserRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := client.HasUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHasUserRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := server.HasUser(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_User_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_User_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_User_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Expires_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_Expires_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_Expires_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HasUser_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_HasUser_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_HasUser_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_User_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_User_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_User_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_Expires_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_Expires_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_Expires_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HasUser_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_HasUser_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_HasUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_User_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "user", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_Expires_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "expires", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_HasUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "has_user", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_User_0 = runtime.ForwardResponseMessage + + forward_Query_Expires_0 = runtime.ForwardResponseMessage + + forward_Query_HasUser_0 = runtime.ForwardResponseMessage +) diff --git a/modules/rental/types/rental.pb.go b/modules/rental/types/rental.pb.go index 129f2693..7a8f6b98 100644 --- a/modules/rental/types/rental.pb.go +++ b/modules/rental/types/rental.pb.go @@ -23,8 +23,9 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// RentalInfo defines a rental info type RentalInfo struct { - Renter string `protobuf:"bytes,1,opt,name=renter,proto3" json:"renter,omitempty"` + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` Expires uint64 `protobuf:"varint,2,opt,name=expires,proto3" json:"expires,omitempty"` } @@ -61,6 +62,20 @@ func (m *RentalInfo) XXX_DiscardUnknown() { var xxx_messageInfo_RentalInfo proto.InternalMessageInfo +func (m *RentalInfo) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +func (m *RentalInfo) GetExpires() uint64 { + if m != nil { + return m.Expires + } + return 0 +} + func init() { proto.RegisterType((*RentalInfo)(nil), "irismod.rental.RentalInfo") } @@ -68,19 +83,19 @@ func init() { func init() { proto.RegisterFile("rental/rental.proto", fileDescriptor_a38471509ee7f89e) } var fileDescriptor_a38471509ee7f89e = []byte{ - // 187 bytes of a gzipped FileDescriptorProto + // 183 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x4a, 0xcd, 0x2b, 0x49, 0xcc, 0xd1, 0x87, 0x50, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x7c, 0x99, 0x45, 0x99, 0xc5, 0xb9, 0xf9, 0x29, 0x7a, 0x10, 0x51, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0xb0, 0x94, 0x3e, - 0x88, 0x05, 0x51, 0xa5, 0x64, 0xc7, 0xc5, 0x15, 0x04, 0x96, 0xf7, 0xcc, 0x4b, 0xcb, 0x17, 0x12, - 0xe3, 0x62, 0x03, 0xa9, 0x4e, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0xf2, 0x84, + 0x88, 0x05, 0x51, 0xa5, 0x64, 0xc5, 0xc5, 0x15, 0x04, 0x96, 0xf7, 0xcc, 0x4b, 0xcb, 0x17, 0x12, + 0xe2, 0x62, 0x29, 0x2d, 0x4e, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, 0x24, 0xb8, 0xd8, 0x53, 0x2b, 0x0a, 0x32, 0x8b, 0x52, 0x8b, 0x25, 0x98, 0x14, 0x18, 0x35, 0x58, - 0x82, 0x60, 0x5c, 0x27, 0xdf, 0x13, 0x0f, 0xe5, 0x18, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, - 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, - 0x58, 0x8e, 0x21, 0x4a, 0x3f, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, - 0xe4, 0x9c, 0xbc, 0xd4, 0x12, 0x7d, 0xa8, 0xb3, 0xf4, 0x73, 0xf3, 0x53, 0x4a, 0x73, 0x52, 0x8b, - 0xa1, 0x8e, 0xd6, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xbb, 0xca, 0x18, 0x10, 0x00, - 0x00, 0xff, 0xff, 0x25, 0x45, 0xe8, 0x77, 0xd2, 0x00, 0x00, 0x00, + 0x82, 0x60, 0x5c, 0x27, 0xcf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, + 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, + 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x39, 0x23, 0x2f, 0xb5, + 0x44, 0x1f, 0xea, 0x1c, 0xfd, 0xdc, 0xfc, 0x94, 0xd2, 0x9c, 0xd4, 0x62, 0xa8, 0x63, 0xf5, 0x4b, + 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xae, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x0e, + 0x23, 0x75, 0x73, 0xca, 0x00, 0x00, 0x00, } func (m *RentalInfo) Marshal() (dAtA []byte, err error) { @@ -108,10 +123,10 @@ func (m *RentalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if len(m.Renter) > 0 { - i -= len(m.Renter) - copy(dAtA[i:], m.Renter) - i = encodeVarintRental(dAtA, i, uint64(len(m.Renter))) + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintRental(dAtA, i, uint64(len(m.User))) i-- dAtA[i] = 0xa } @@ -135,7 +150,7 @@ func (m *RentalInfo) Size() (n int) { } var l int _ = l - l = len(m.Renter) + l = len(m.User) if l > 0 { n += 1 + l + sovRental(uint64(l)) } @@ -182,7 +197,7 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Renter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -210,7 +225,7 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Renter = string(dAtA[iNdEx:postIndex]) + m.User = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 0 { diff --git a/modules/rental/types/tx.pb.go b/modules/rental/types/tx.pb.go index d1ab5d74..2df775cd 100644 --- a/modules/rental/types/tx.pb.go +++ b/modules/rental/types/tx.pb.go @@ -28,6 +28,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgSetUser defines the Msg/SetUser response type. type MsgSetUser struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` @@ -69,6 +70,7 @@ func (m *MsgSetUser) XXX_DiscardUnknown() { var xxx_messageInfo_MsgSetUser proto.InternalMessageInfo +// MsgSetUserResponse defines the Msg/SetUser response type. type MsgSetUserResponse struct { } @@ -146,6 +148,7 @@ const _ = grpc.SupportPackageIsVersion4 // // 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 { + // SetUser defines a method for issue an nft SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.CallOption) (*MsgSetUserResponse, error) } @@ -168,6 +171,7 @@ func (c *msgClient) SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.Ca // MsgServer is the server API for Msg service. type MsgServer interface { + // SetUser defines a method for issue an nft SetUser(context.Context, *MsgSetUser) (*MsgSetUserResponse, error) } diff --git a/proto/rental/genesis.proto b/proto/rental/genesis.proto index 666022fa..6ad6b922 100644 --- a/proto/rental/genesis.proto +++ b/proto/rental/genesis.proto @@ -5,8 +5,8 @@ import "gogoproto/gogo.proto"; import "rental/rental.proto"; option go_package = "github.com/irisnet/irismod/modules/rental/types"; -option (gogoproto.goproto_getters_all) = false; +// GenesisState defines the rental module's genesis state message GenesisState { repeated RentalInfo renterInfos = 1 [ (gogoproto.nullable) = false ]; } \ No newline at end of file diff --git a/proto/rental/query.proto b/proto/rental/query.proto index 98c6346d..41e5c73c 100644 --- a/proto/rental/query.proto +++ b/proto/rental/query.proto @@ -2,27 +2,50 @@ syntax = "proto3"; package irismod.rental; import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; option go_package = "github.com/irisnet/irismod/modules/rental/types"; option (gogoproto.goproto_getters_all) = false; +// Query defines the gPRC querier service for rental module. service Query { - rpc UserOf(MsgUserOfRequest) returns (MsgUserOfResponse); - rpc UserExpires(MsgUserExpiresRequest) returns (MsgUserExpiresResponse); - rpc HaveUser(MsgHaveUserRequest) returns (MsgHaveUserResponse); + // + rpc User(QueryUserRequest) returns (QueryUserResponse) { + option (google.api.http).get = "/irismod/rental/user/{class_id}/{nft_id}"; + }; + rpc Expires(QueryExpiresRequest) returns (QueryExpiresResponse) { + option (google.api.http).get = + "/irismod/rental/expires/{class_id}/{nft_id}"; + }; + rpc HasUser(QueryHasUserRequest) returns (QueryHasUserResponse) { + option (google.api.http).get = + "/irismod/rental/has_user/{class_id}/{nft_id}"; + } } -message MsgUserOfRequest { + +// QueryUserRequest is the request type for the Query/Renter RPC method +message QueryUserRequest { string class_id = 1; string nft_id = 2; } -message MsgUserOfResponse { string renter = 1; } -message MsgUserExpiresRequest { + +// QueryUserResponse is the response type for the Query/Renter RPC method +message QueryUserResponse { string user = 1; } + +// QueryExpiresRequest is the request type for the Query/Expires RPC method +message QueryExpiresRequest { string class_id = 1; string nft_id = 2; } -message MsgUserExpiresResponse { uint64 expires = 1; } -message MsgHaveUserRequest { + +// QueryExpiresResponse is the response type for the Query/Expires RPC method +message QueryExpiresResponse { uint64 expires = 1; } + +// QueryHasUserRequest is the request type for the Query/HasUser RPC method +message QueryHasUserRequest { string class_id = 1; string nft_id = 2; } -message MsgHaveUserResponse { bool had_renter = 1; } \ No newline at end of file + +// QueryHasUserResponse is the response type for the Query/HasUser RPC method +message QueryHasUserResponse { bool has_user = 1; } \ No newline at end of file diff --git a/proto/rental/rental.proto b/proto/rental/rental.proto index a09ea999..d2e6cdd7 100644 --- a/proto/rental/rental.proto +++ b/proto/rental/rental.proto @@ -4,9 +4,9 @@ package irismod.rental; import "gogoproto/gogo.proto"; option go_package = "github.com/irisnet/irismod/modules/rental/types"; -option (gogoproto.goproto_getters_all) = false; +// RentalInfo defines a rental info message RentalInfo { - string renter = 1; + string user = 1; uint64 expires = 2; } \ No newline at end of file diff --git a/proto/rental/tx.proto b/proto/rental/tx.proto index bab2fe94..26b8f972 100644 --- a/proto/rental/tx.proto +++ b/proto/rental/tx.proto @@ -6,10 +6,13 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/irisnet/irismod/modules/rental/types"; option (gogoproto.goproto_getters_all) = false; +// Msg defines the rental Msg service. service Msg { + // SetUser defines a method for issue an nft rpc SetUser(MsgSetUser) returns (MsgSetUserResponse) {} } +// MsgSetUser defines the Msg/SetUser response type. message MsgSetUser { string class_id = 1; string nft_id = 2; @@ -18,4 +21,5 @@ message MsgSetUser { string sender = 5; } +// MsgSetUserResponse defines the Msg/SetUser response type. message MsgSetUserResponse {} \ No newline at end of file From 87f2b90464717b27d00a23ecfb3b74526961e7b2 Mon Sep 17 00:00:00 2001 From: yuandu Date: Thu, 15 Dec 2022 16:09:59 +0800 Subject: [PATCH 06/20] fix rental proto and types --- modules/rental/types/codec.go | 13 ++- modules/rental/types/errors.go | 5 +- modules/rental/types/genesis.go | 30 +++++-- modules/rental/types/msgs.go | 56 ++++++++++--- modules/rental/types/rental.go | 1 - modules/rental/types/rental.pb.go | 134 ++++++++++++++++++++++++++---- modules/rental/types/tx.pb.go | 70 ++++++++-------- proto/rental/rental.proto | 4 +- proto/rental/tx.proto | 4 +- 9 files changed, 236 insertions(+), 81 deletions(-) delete mode 100644 modules/rental/types/rental.go diff --git a/modules/rental/types/codec.go b/modules/rental/types/codec.go index 27753c49..4bbb2bcb 100644 --- a/modules/rental/types/codec.go +++ b/modules/rental/types/codec.go @@ -4,6 +4,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "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 ( @@ -12,13 +14,16 @@ var ( ) func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // fixme - panic("Fixme!") + cdc.RegisterConcrete(&MsgSetUser{}, "irismod/rental/MsgSetUser", nil) } func RegisterInterfaces(registry types.InterfaceRegistry) { - // fixme - panic("Fixme!") + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgSetUser{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } func init() { diff --git a/modules/rental/types/errors.go b/modules/rental/types/errors.go index 6f52c17d..d74f174b 100644 --- a/modules/rental/types/errors.go +++ b/modules/rental/types/errors.go @@ -3,6 +3,7 @@ package types import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" var ( - // fixme - ErrInvalidRentalInfos = sdkerrors.Register(ModuleName, 1, "invalid rental infos") + ErrInvalidNftID = sdkerrors.Register(ModuleName, 1, "invalid nft id") + ErrInvalidClassID = sdkerrors.Register(ModuleName, 2, "invalid class id") + ErrInvalidExpires = sdkerrors.Register(ModuleName, 3, "invalid expires") ) diff --git a/modules/rental/types/genesis.go b/modules/rental/types/genesis.go index 14046a3b..93e9b1cc 100644 --- a/modules/rental/types/genesis.go +++ b/modules/rental/types/genesis.go @@ -2,17 +2,13 @@ package types import ( "encoding/json" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + nfttypes "github.com/cosmos/cosmos-sdk/x/nft" "github.com/cosmos/cosmos-sdk/codec" ) -// Validate performs basic validation of supply genesis data returning an -// error for any failed validation criteria. -func (gs GenesisState) Validate() error { - // Fixme! - panic("Fixme!") -} - // NewGenesisState creates a new genesis state. func NewGenesisState(renterInfos []RentalInfo) *GenesisState { return &GenesisState{ @@ -37,6 +33,22 @@ func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.R } // ValidateGenesis check the given genesis state has no integrity issues -func ValidateGenesis(data GenesisState) error { - panic("Fixme!") +func ValidateGenesis(gs GenesisState) error { + for _, v := range gs.RenterInfos { + if err := nfttypes.ValidateClassID(v.ClassId); err != nil { + return sdkerrors.Wrapf(ErrInvalidClassID, "Invalid class id (%s)", v.ClassId) + } + + if err := nfttypes.ValidateNFTID(v.NftId); err != nil { + return sdkerrors.Wrapf(ErrInvalidNftID, "Invalid nft id (%s)", v.NftId) + + } + + _, err := sdk.AccAddressFromBech32(v.User) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid user address (%s)", v.User) + } + } + + return nil } diff --git a/modules/rental/types/msgs.go b/modules/rental/types/msgs.go index c3c58d86..785e0427 100644 --- a/modules/rental/types/msgs.go +++ b/modules/rental/types/msgs.go @@ -2,6 +2,8 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + nfttypes "github.com/cosmos/cosmos-sdk/x/nft" ) const ( @@ -12,29 +14,59 @@ var ( _ sdk.Msg = &MsgSetUser{} ) -func NewMsgSetUser(classId, nftId, renter string, - expire uint64, sender string) *MsgSetUser { +func NewMsgSetUser(classId, nftId, user string, + expires uint64, sender string) *MsgSetUser { return &MsgSetUser{ ClassId: classId, NftId: nftId, - Renter: renter, - Expire: expire, + User: user, + Expires: expires, Sender: sender, } } -func (MsgSetUser) Route() string { return RouterKey } +// Route Implements LegacyMsg +func (m MsgSetUser) Route() string { return RouterKey } -func (MsgSetUser) Type() string { return TypeMsgSetUser } +// Type Implements LegacyMsg +func (m MsgSetUser) Type() string { return TypeMsgSetUser } -func (MsgSetUser) ValidateBasic() error { - panic("Fixme") +// GetSignBytes Implements LegacyMsg +func (m MsgSetUser) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&m) + return sdk.MustSortJSON(bz) } -func (MsgSetUser) GetSignBytes() []byte { - panic("Fixme") +// ValidateBasic implements the Msg.ValidateBasic method. +func (m MsgSetUser) ValidateBasic() error { + if err := nfttypes.ValidateClassID(m.ClassId); err != nil { + return sdkerrors.Wrapf(ErrInvalidClassID, "Invalid class id (%s)", m.ClassId) + } + + if err := nfttypes.ValidateNFTID(m.NftId); err != nil { + return sdkerrors.Wrapf(ErrInvalidNftID, "Invalid nft id (%s)", m.NftId) + } + + _, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", m.Sender) + } + + _, err = sdk.AccAddressFromBech32(m.User) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid user address (%s)", m.User) + + } + + if m.Expires == 0 { + return sdkerrors.Wrapf(ErrInvalidExpires, "Invalid expires (%d)", m.Expires) + } + + return nil } -func (MsgSetUser) GetSigners() []sdk.AccAddress { - panic("Fixme") +// GetSigners implements the Msg.GetSigners method. +func (m MsgSetUser) GetSigners() []sdk.AccAddress { + signer, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{signer} } diff --git a/modules/rental/types/rental.go b/modules/rental/types/rental.go deleted file mode 100644 index ab1254f4..00000000 --- a/modules/rental/types/rental.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/modules/rental/types/rental.pb.go b/modules/rental/types/rental.pb.go index 7a8f6b98..0e47e7f5 100644 --- a/modules/rental/types/rental.pb.go +++ b/modules/rental/types/rental.pb.go @@ -26,7 +26,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // RentalInfo defines a rental info type RentalInfo struct { User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - Expires uint64 `protobuf:"varint,2,opt,name=expires,proto3" json:"expires,omitempty"` + ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + Expires uint64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` } func (m *RentalInfo) Reset() { *m = RentalInfo{} } @@ -69,6 +71,20 @@ func (m *RentalInfo) GetUser() string { return "" } +func (m *RentalInfo) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *RentalInfo) GetNftId() string { + if m != nil { + return m.NftId + } + return "" +} + func (m *RentalInfo) GetExpires() uint64 { if m != nil { return m.Expires @@ -83,19 +99,21 @@ func init() { func init() { proto.RegisterFile("rental/rental.proto", fileDescriptor_a38471509ee7f89e) } var fileDescriptor_a38471509ee7f89e = []byte{ - // 183 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0x4a, 0xcd, 0x2b, - 0x49, 0xcc, 0xd1, 0x87, 0x50, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x7c, 0x99, 0x45, 0x99, - 0xc5, 0xb9, 0xf9, 0x29, 0x7a, 0x10, 0x51, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0xb0, 0x94, 0x3e, - 0x88, 0x05, 0x51, 0xa5, 0x64, 0xc5, 0xc5, 0x15, 0x04, 0x96, 0xf7, 0xcc, 0x4b, 0xcb, 0x17, 0x12, - 0xe2, 0x62, 0x29, 0x2d, 0x4e, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x02, 0xb3, 0x85, - 0x24, 0xb8, 0xd8, 0x53, 0x2b, 0x0a, 0x32, 0x8b, 0x52, 0x8b, 0x25, 0x98, 0x14, 0x18, 0x35, 0x58, - 0x82, 0x60, 0x5c, 0x27, 0xcf, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, - 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0xd2, - 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x07, 0x39, 0x23, 0x2f, 0xb5, - 0x44, 0x1f, 0xea, 0x1c, 0xfd, 0xdc, 0xfc, 0x94, 0xd2, 0x9c, 0xd4, 0x62, 0xa8, 0x63, 0xf5, 0x4b, - 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xae, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x0e, - 0x23, 0x75, 0x73, 0xca, 0x00, 0x00, 0x00, + // 219 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x8f, 0xb1, 0x4e, 0x86, 0x30, + 0x14, 0x85, 0xa9, 0xe2, 0x8f, 0x76, 0x70, 0xa8, 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f, 0x00, + 0x00, 0xff, 0xff, 0xa2, 0xbf, 0x96, 0xdb, 0xfc, 0x00, 0x00, 0x00, } func (m *RentalInfo) Marshal() (dAtA []byte, err error) { @@ -121,7 +139,21 @@ func (m *RentalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m.Expires != 0 { i = encodeVarintRental(dAtA, i, uint64(m.Expires)) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x20 + } + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintRental(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x1a + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintRental(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0x12 } if len(m.User) > 0 { i -= len(m.User) @@ -154,6 +186,14 @@ func (m *RentalInfo) Size() (n int) { if l > 0 { n += 1 + l + sovRental(uint64(l)) } + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovRental(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovRental(uint64(l)) + } if m.Expires != 0 { n += 1 + sovRental(uint64(m.Expires)) } @@ -228,6 +268,70 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { m.User = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + 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 ErrInvalidLengthRental + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRental + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + 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 ErrInvalidLengthRental + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRental + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) } diff --git a/modules/rental/types/tx.pb.go b/modules/rental/types/tx.pb.go index 2df775cd..e0652a28 100644 --- a/modules/rental/types/tx.pb.go +++ b/modules/rental/types/tx.pb.go @@ -32,8 +32,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgSetUser struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Renter string `protobuf:"bytes,3,opt,name=renter,proto3" json:"renter,omitempty"` - Expire uint64 `protobuf:"varint,4,opt,name=expire,proto3" json:"expire,omitempty"` + User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"` + Expires uint64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` } @@ -115,25 +115,25 @@ func init() { func init() { proto.RegisterFile("rental/tx.proto", fileDescriptor_94fd51cc9a4073b5) } var fileDescriptor_94fd51cc9a4073b5 = []byte{ - // 279 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xbd, 0x4e, 0xc3, 0x30, - 0x14, 0x85, 0x63, 0xda, 0xa6, 0xe0, 0x01, 0x24, 0xab, 0xa0, 0x90, 0xc1, 0xaa, 0x32, 0x75, 0x8a, - 0x25, 0x78, 0x03, 0xb6, 0x0a, 0x65, 0x09, 0x62, 0x61, 0x41, 0x6d, 0x7d, 0x1b, 0x22, 0x25, 0x76, - 0xe4, 0xeb, 0x4a, 0xe5, 0x05, 0x98, 0x79, 0xac, 0x8e, 0x1d, 0x19, 0x21, 0x79, 0x11, 0xe4, 0xfc, - 0xa8, 0x62, 0x60, 0xf3, 0x39, 0xdf, 0xf5, 0xf1, 0xf5, 0xa1, 0x57, 0x06, 0x94, 0x5d, 0x15, 0xc2, - 0xee, 0xe3, 0xca, 0x68, 0xab, 0xd9, 0x65, 0x6e, 0x72, 0x2c, 0xb5, 0x8c, 0x3b, 0x10, 0xce, 0x32, - 0x9d, 0xe9, 0x16, 0x09, 0x77, 0xea, 0xa6, 0xa2, 0x0f, 0x42, 0x69, 0x82, 0xd9, 0x13, 0xd8, 0x67, - 0x04, 0xc3, 0x6e, 0xe9, 0xf9, 0xa6, 0x58, 0x21, 0xbe, 0xe6, 0x32, 0x20, 0x73, 0xb2, 0xb8, 0x48, - 0xa7, 0xad, 0x5e, 0x4a, 0x76, 0x4d, 0x7d, 0xb5, 0xb5, 0x0e, 0x9c, 0xb5, 0x60, 0xa2, 0xb6, 0x76, - 0x29, 0xd9, 0x0d, 0xf5, 0xdd, 0x03, 0x60, 0x82, 0x51, 0x6b, 0xf7, 0xca, 0xf9, 0xb0, 0xaf, 0x72, - 0x03, 0xc1, 0x78, 0x4e, 0x16, 0xe3, 0xb4, 0x57, 0xce, 0x47, 0x50, 0x12, 0x4c, 0x30, 0xe9, 0xe6, - 0x3b, 0x15, 0xcd, 0x28, 0x3b, 0xed, 0x91, 0x02, 0x56, 0x5a, 0x21, 0xdc, 0xa5, 0x74, 0x94, 0x60, - 0xc6, 0x1e, 0xe9, 0x74, 0xd8, 0x30, 0x8c, 0xff, 0xfe, 0x2b, 0x3e, 0xdd, 0x0a, 0xa3, 0xff, 0xd9, - 0x90, 0x18, 0x79, 0x0f, 0xc9, 0xe1, 0x87, 0x7b, 0x87, 0x9a, 0x93, 0x63, 0xcd, 0xc9, 0x77, 0xcd, - 0xc9, 0x67, 0xc3, 0xbd, 0x63, 0xc3, 0xbd, 0xaf, 0x86, 0x7b, 0x2f, 0x22, 0xcb, 0xed, 0xdb, 0x6e, - 0x1d, 0x6f, 0x74, 0x29, 0x5c, 0x9a, 0x02, 0x2b, 0xfa, 0x54, 0x51, 0x6a, 0xb9, 0x2b, 0x00, 0xc5, - 0x50, 0xf5, 0x7b, 0x05, 0xb8, 0xf6, 0xdb, 0x22, 0xef, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x9c, - 0xce, 0x49, 0x44, 0x81, 0x01, 0x00, 0x00, + // 281 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xb1, 0x4e, 0xc3, 0x30, + 0x10, 0x86, 0x63, 0xda, 0x26, 0xe0, 0x01, 0x24, 0xab, 0xa0, 0x90, 0xc1, 0xaa, 0x32, 0x75, 0x8a, + 0x25, 0x78, 0x03, 0xb6, 0x0a, 0x65, 0x09, 0x62, 0x61, 0x41, 0x6d, 0x7d, 0x0d, 0x91, 0x12, 0x3b, + 0xf2, 0x39, 0x52, 0xd9, 0x79, 0x00, 0x1e, 0xab, 0x63, 0x47, 0x46, 0x48, 0x5e, 0x04, 0xc5, 0x6d, + 0x54, 0x31, 0xb0, 0xdd, 0xef, 0xef, 0xfc, 0xeb, 0xbf, 0x9f, 0x5e, 0x19, 0x50, 0x76, 0x59, 0x0a, + 0xbb, 0x4d, 0x6a, 0xa3, 0xad, 0x66, 0x97, 0x85, 0x29, 0xb0, 0xd2, 0x32, 0x39, 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f6, 0x7f, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -245,15 +245,15 @@ func (m *MsgSetUser) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if m.Expire != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Expire)) + if m.Expires != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Expires)) i-- dAtA[i] = 0x20 } - if len(m.Renter) > 0 { - i -= len(m.Renter) - copy(dAtA[i:], m.Renter) - i = encodeVarintTx(dAtA, i, uint64(len(m.Renter))) + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintTx(dAtA, i, uint64(len(m.User))) i-- dAtA[i] = 0x1a } @@ -322,12 +322,12 @@ func (m *MsgSetUser) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Renter) + l = len(m.User) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.Expire != 0 { - n += 1 + sovTx(uint64(m.Expire)) + if m.Expires != 0 { + n += 1 + sovTx(uint64(m.Expires)) } l = len(m.Sender) if l > 0 { @@ -446,7 +446,7 @@ func (m *MsgSetUser) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Renter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -474,13 +474,13 @@ func (m *MsgSetUser) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Renter = string(dAtA[iNdEx:postIndex]) + m.User = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expire", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) } - m.Expire = 0 + m.Expires = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -490,7 +490,7 @@ func (m *MsgSetUser) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Expire |= uint64(b&0x7F) << shift + m.Expires |= uint64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/rental/rental.proto b/proto/rental/rental.proto index d2e6cdd7..bba341c2 100644 --- a/proto/rental/rental.proto +++ b/proto/rental/rental.proto @@ -8,5 +8,7 @@ option go_package = "github.com/irisnet/irismod/modules/rental/types"; // RentalInfo defines a rental info message RentalInfo { string user = 1; - uint64 expires = 2; + string class_id = 2; + string nft_id = 3; + uint64 expires = 4; } \ No newline at end of file diff --git a/proto/rental/tx.proto b/proto/rental/tx.proto index 26b8f972..844be29f 100644 --- a/proto/rental/tx.proto +++ b/proto/rental/tx.proto @@ -16,8 +16,8 @@ service Msg { message MsgSetUser { string class_id = 1; string nft_id = 2; - string renter = 3; - uint64 expire = 4; + string user = 3; + uint64 expires = 4; string sender = 5; } From b8965eeb9bad5be47411a0c8a0e19cb228060769 Mon Sep 17 00:00:00 2001 From: yuandu Date: Thu, 15 Dec 2022 19:21:43 +0800 Subject: [PATCH 07/20] impl rental msg server --- modules/rental/keeper/keeper.go | 6 ++- modules/rental/keeper/keys.go | 68 +++++++++++++++++++++++++++++ modules/rental/keeper/msg_server.go | 48 +++++++++++++++++++- modules/rental/keeper/rental.go | 24 ++++++++++ modules/rental/types/errors.go | 8 ++-- modules/rental/types/events.go | 7 ++- 6 files changed, 152 insertions(+), 9 deletions(-) create mode 100644 modules/rental/keeper/rental.go diff --git a/modules/rental/keeper/keeper.go b/modules/rental/keeper/keeper.go index 257808ca..21d2c879 100644 --- a/modules/rental/keeper/keeper.go +++ b/modules/rental/keeper/keeper.go @@ -3,18 +3,20 @@ package keeper import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" + nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" ) type Keeper struct { storeKey storetypes.StoreKey cdc codec.Codec - // fixme: necessary? nk nftkeeper.Keeper + nk nftkeeper.Keeper } // NewKeeper creates a new instance of rental keeper -func NewKeeper(cdc codec.Codec, storeKey storetypes.StoreKey) Keeper { +func NewKeeper(cdc codec.Codec, storeKey storetypes.StoreKey, nk nftkeeper.Keeper) Keeper { return Keeper{ storeKey: storeKey, cdc: cdc, + nk: nk, } } diff --git a/modules/rental/keeper/keys.go b/modules/rental/keeper/keys.go index 5af6199e..8635c4d0 100644 --- a/modules/rental/keeper/keys.go +++ b/modules/rental/keeper/keys.go @@ -1,7 +1,75 @@ package keeper import ( + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/irisnet/irismod/modules/rental/types" + "reflect" + "strconv" + "unsafe" ) +var ( + RentalInfoKey = []byte{0x01} + + Delimiter = []byte{0x00} +) + +// StoreKey is the store key for rental module const StoreKey = types.ModuleName + +// rentalInfoKey returns the byte representation of the rental info key. +// This key comprises of <0x01> +func rentalInfoKey(classId, nftId string) []byte { + classIdBz := unsafeStrToBytes(classId) + nftIdBz := unsafeStrToBytes(nftId) + + key := make([]byte, len(RentalInfoKey)+len(classIdBz)+len(Delimiter)+len(nftIdBz)) + + copy(key, RentalInfoKey) + copy(key[len(RentalInfoKey):], classIdBz) + copy(key[len(RentalInfoKey)+len(classIdBz):], Delimiter) + copy(key[len(RentalInfoKey)+len(classIdBz)+len(Delimiter):], nftIdBz) + + return key +} + +// rentalInfoValue returns the byte representation of the rental info value. +// This value comprises of +func rentalInfoValue(user sdk.AccAddress, expires uint64) []byte { + userBz := user.Bytes() + expiresBz := []byte(strconv.FormatUint(expires, 10)) + + value := make([]byte, len(userBz)+len(Delimiter)+len(expiresBz)) + copy(value, userBz) + copy(value[len(userBz):], Delimiter) + copy(value[len(userBz)+len(Delimiter):], expiresBz) + + return value +} + +// splitRentalInfoValue returns the user and expires of a rental info bytes. +func splitRentalInfoValue(rfv []byte) (user []byte, expires uint64) { + panic("Fixme") +} + +// The following functions refers to cosmos-sdk/internal/conv/string.go + +// unsafeStrToBytes uses unsafe to convert string into byte array. Returned bytes +// must not be altered after this function is called as it will cause a segmentation fault. +func unsafeStrToBytes(s string) []byte { + var buf []byte + sHdr := (*reflect.StringHeader)(unsafe.Pointer(&s)) + bufHdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) + bufHdr.Data = sHdr.Data + bufHdr.Cap = sHdr.Len + bufHdr.Len = sHdr.Len + return buf +} + +// unsafeBytesToStr is meant to make a zero allocation conversion +// from []byte -> string to speed up operations, it is not meant +// to be used generally, but for a specific pattern to delete keys +// from a map. +func unsafeBytesToStr(b []byte) string { + return *(*string)(unsafe.Pointer(&b)) +} diff --git a/modules/rental/keeper/msg_server.go b/modules/rental/keeper/msg_server.go index fb53cbee..f4063226 100644 --- a/modules/rental/keeper/msg_server.go +++ b/modules/rental/keeper/msg_server.go @@ -2,14 +2,58 @@ package keeper import ( "context" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "strconv" "github.com/irisnet/irismod/modules/rental/types" ) var _ types.MsgServer = Keeper{} +// SetUser set a user and expires time for an existent nft func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.MsgSetUserResponse, error) { - // todo: set user - // todo: event + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + user, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // sender must own or be approved for this nft + if owner := k.nk.GetOwner(ctx, msg.ClassId, msg.NftId); !owner.Equals(sender) { + return nil, sdkerrors.Wrapf(types.ErrNotApprovedNorOwner, "Not owner (%s)", msg.Sender) + } + + // this nft must expire if to be set again. + // FIXME: proto should use int64 or Time than uint64 + u, e := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) + if u != nil && ctx.BlockTime().Unix() < int64(e) { + return nil, sdkerrors.Wrapf(types.ErrNotArriveExpires, "Expires is (%d)", e) + } + + // set rental info + k.setRentalInfo(ctx, msg.ClassId, msg.NftId, user, msg.Expires) + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeSetUser, + sdk.NewAttribute(types.AttributeKeyClassId, msg.ClassId), + sdk.NewAttribute(types.AttributeKeyNftId, msg.NftId), + sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatUint(msg.Expires, 10)), + sdk.NewAttribute(types.AttributeKeyUser, msg.User), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), + ), + }) + return &types.MsgSetUserResponse{}, nil } diff --git a/modules/rental/keeper/rental.go b/modules/rental/keeper/rental.go new file mode 100644 index 00000000..275f7f34 --- /dev/null +++ b/modules/rental/keeper/rental.go @@ -0,0 +1,24 @@ +package keeper + +import sdk "github.com/cosmos/cosmos-sdk/types" + +// setRentalInfo sets the rental info for an nft. +func (k Keeper) setRentalInfo(ctx sdk.Context, + classId, nftId string, + user sdk.AccAddress, + expires uint64) { + store := ctx.KVStore(k.storeKey) + store.Set(rentalInfoKey(classId, nftId), rentalInfoValue(user, expires)) +} + +// getRentalInfo returns the rental info for an nft. +func (k Keeper) getRentalInfo(ctx sdk.Context, + classId, nftId string) (user sdk.AccAddress, expires uint64) { + store := ctx.KVStore(k.storeKey) + vbz := store.Get(rentalInfoKey(classId, nftId)) + + if vbz != nil { + user, expires = splitRentalInfoValue(vbz) + } + return +} diff --git a/modules/rental/types/errors.go b/modules/rental/types/errors.go index d74f174b..a9f34ce8 100644 --- a/modules/rental/types/errors.go +++ b/modules/rental/types/errors.go @@ -3,7 +3,9 @@ package types import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" var ( - ErrInvalidNftID = sdkerrors.Register(ModuleName, 1, "invalid nft id") - ErrInvalidClassID = sdkerrors.Register(ModuleName, 2, "invalid class id") - ErrInvalidExpires = sdkerrors.Register(ModuleName, 3, "invalid expires") + ErrInvalidNftID = sdkerrors.Register(ModuleName, 1, "invalid nft id") + ErrInvalidClassID = sdkerrors.Register(ModuleName, 2, "invalid class id") + ErrInvalidExpires = sdkerrors.Register(ModuleName, 3, "invalid expires") + ErrNotApprovedNorOwner = sdkerrors.Register(ModuleName, 4, "sender is not owner nor approved") + ErrNotArriveExpires = sdkerrors.Register(ModuleName, 5, "rental has not expires") ) diff --git a/modules/rental/types/events.go b/modules/rental/types/events.go index 6fc883d7..4d7f4418 100644 --- a/modules/rental/types/events.go +++ b/modules/rental/types/events.go @@ -2,10 +2,13 @@ package types // rental module event types var ( - // fixme EventTypeSetUser = "set_user" AttributeValueCategory = ModuleName - AttributeKeySender = "sender" + AttributeKeySender = "sender" + AttributeKeyUser = "user" + AttributeKeyClassId = "class_id" + AttributeKeyNftId = "nft_id" + AttributeKeyExpires = "expires" ) From 831544c4e47e12b7f458c32560db72ccdaa56709 Mon Sep 17 00:00:00 2001 From: yuandu Date: Fri, 16 Dec 2022 11:02:21 +0800 Subject: [PATCH 08/20] imp rental query server --- modules/rental/keeper/grpc_query.go | 49 ++++++++++++++++++++++++----- modules/rental/keeper/keys.go | 21 ------------- modules/rental/keeper/msg_server.go | 6 ++-- modules/rental/keeper/rental.go | 27 +++++++++++----- modules/rental/types/errors.go | 12 ++++--- 5 files changed, 71 insertions(+), 44 deletions(-) diff --git a/modules/rental/keeper/grpc_query.go b/modules/rental/keeper/grpc_query.go index 3969bdfb..47e1d6d1 100644 --- a/modules/rental/keeper/grpc_query.go +++ b/modules/rental/keeper/grpc_query.go @@ -2,19 +2,54 @@ package keeper import ( "context" - + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/rental/types" ) var _ types.QueryServer = Keeper{} -func (k Keeper) User(context.Context, *types.QueryUserRequest) (*types.QueryUserResponse, error) { - panic("Fixme") +// User queries the user of an nft +func (k Keeper) User(goCtx context.Context, msg *types.QueryUserRequest) (*types.QueryUserResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrNotExistentNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + } + + rental, exist := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) + if !exist { + return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) + } + + return &types.QueryUserResponse{User: rental.User}, nil } -func (k Keeper) Expires(context.Context, *types.QueryExpiresRequest) (*types.QueryExpiresResponse, error) { - panic("Fixme") + +// Expires queries the expires of an nft +func (k Keeper) Expires(goCtx context.Context, msg *types.QueryExpiresRequest) (*types.QueryExpiresResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrNotExistentNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + } + + rental, exist := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) + if !exist { + return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) + } + + return &types.QueryExpiresResponse{Expires: rental.Expires}, nil } -func (k Keeper) HasUser(context.Context, *types.QueryHasUserRequest) (*types.QueryHasUserResponse, error) { - panic("Fixme") +// Expires queries if an nft has the user +// WARNING: it deson't check if this rental has expires +func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) (*types.QueryHasUserResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrNotExistentNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + } + + _, exist := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) + return &types.QueryHasUserResponse{HasUser: exist}, nil } diff --git a/modules/rental/keeper/keys.go b/modules/rental/keeper/keys.go index 8635c4d0..e77c3a52 100644 --- a/modules/rental/keeper/keys.go +++ b/modules/rental/keeper/keys.go @@ -1,10 +1,8 @@ package keeper import ( - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/irisnet/irismod/modules/rental/types" "reflect" - "strconv" "unsafe" ) @@ -33,25 +31,6 @@ func rentalInfoKey(classId, nftId string) []byte { return key } -// rentalInfoValue returns the byte representation of the rental info value. -// This value comprises of -func rentalInfoValue(user sdk.AccAddress, expires uint64) []byte { - userBz := user.Bytes() - expiresBz := []byte(strconv.FormatUint(expires, 10)) - - value := make([]byte, len(userBz)+len(Delimiter)+len(expiresBz)) - copy(value, userBz) - copy(value[len(userBz):], Delimiter) - copy(value[len(userBz)+len(Delimiter):], expiresBz) - - return value -} - -// splitRentalInfoValue returns the user and expires of a rental info bytes. -func splitRentalInfoValue(rfv []byte) (user []byte, expires uint64) { - panic("Fixme") -} - // The following functions refers to cosmos-sdk/internal/conv/string.go // unsafeStrToBytes uses unsafe to convert string into byte array. Returned bytes diff --git a/modules/rental/keeper/msg_server.go b/modules/rental/keeper/msg_server.go index f4063226..a2f03a8f 100644 --- a/modules/rental/keeper/msg_server.go +++ b/modules/rental/keeper/msg_server.go @@ -32,9 +32,9 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms // this nft must expire if to be set again. // FIXME: proto should use int64 or Time than uint64 - u, e := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) - if u != nil && ctx.BlockTime().Unix() < int64(e) { - return nil, sdkerrors.Wrapf(types.ErrNotArriveExpires, "Expires is (%d)", e) + rental, exist := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) + if exist && ctx.BlockTime().Unix() < int64(rental.Expires) { + return nil, sdkerrors.Wrapf(types.ErrNotArriveExpires, "Expires is (%d)", rental.Expires) } // set rental info diff --git a/modules/rental/keeper/rental.go b/modules/rental/keeper/rental.go index 275f7f34..1825b485 100644 --- a/modules/rental/keeper/rental.go +++ b/modules/rental/keeper/rental.go @@ -1,6 +1,9 @@ package keeper -import sdk "github.com/cosmos/cosmos-sdk/types" +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/irisnet/irismod/modules/rental/types" +) // setRentalInfo sets the rental info for an nft. func (k Keeper) setRentalInfo(ctx sdk.Context, @@ -8,17 +11,25 @@ func (k Keeper) setRentalInfo(ctx sdk.Context, user sdk.AccAddress, expires uint64) { store := ctx.KVStore(k.storeKey) - store.Set(rentalInfoKey(classId, nftId), rentalInfoValue(user, expires)) + r := types.RentalInfo{ + User: user.String(), + ClassId: classId, + NftId: nftId, + Expires: expires, + } + bz := k.cdc.MustMarshal(&r) + store.Set(rentalInfoKey(r.ClassId, r.NftId), bz) } // getRentalInfo returns the rental info for an nft. func (k Keeper) getRentalInfo(ctx sdk.Context, - classId, nftId string) (user sdk.AccAddress, expires uint64) { + classId, nftId string) (types.RentalInfo, bool) { + var v types.RentalInfo store := ctx.KVStore(k.storeKey) - vbz := store.Get(rentalInfoKey(classId, nftId)) - - if vbz != nil { - user, expires = splitRentalInfoValue(vbz) + bz := store.Get(rentalInfoKey(classId, nftId)) + if bz == nil { + return types.RentalInfo{}, false } - return + k.cdc.MustUnmarshal(bz, &v) + return v, true } diff --git a/modules/rental/types/errors.go b/modules/rental/types/errors.go index a9f34ce8..49fb6017 100644 --- a/modules/rental/types/errors.go +++ b/modules/rental/types/errors.go @@ -3,9 +3,11 @@ package types import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" var ( - ErrInvalidNftID = sdkerrors.Register(ModuleName, 1, "invalid nft id") - ErrInvalidClassID = sdkerrors.Register(ModuleName, 2, "invalid class id") - ErrInvalidExpires = sdkerrors.Register(ModuleName, 3, "invalid expires") - ErrNotApprovedNorOwner = sdkerrors.Register(ModuleName, 4, "sender is not owner nor approved") - ErrNotArriveExpires = sdkerrors.Register(ModuleName, 5, "rental has not expires") + ErrInvalidNftID = sdkerrors.Register(ModuleName, 1, "invalid nft id") + ErrInvalidClassID = sdkerrors.Register(ModuleName, 2, "invalid class id") + ErrInvalidExpires = sdkerrors.Register(ModuleName, 3, "invalid expires") + ErrNotApprovedNorOwner = sdkerrors.Register(ModuleName, 4, "sender is not owner nor approved") + ErrNotArriveExpires = sdkerrors.Register(ModuleName, 5, "rental has not expires") + ErrNotExistentNFT = sdkerrors.Register(ModuleName, 6, "nft is not existent") + ErrNotExistentRentalInfo = sdkerrors.Register(ModuleName, 7, "rental info is not existent") ) From 2194d2af3da0aed48b616198191c23ddc2be6ab1 Mon Sep 17 00:00:00 2001 From: yuandu Date: Fri, 16 Dec 2022 12:03:52 +0800 Subject: [PATCH 09/20] fix genesis import/export --- modules/rental/keeper/genesis.go | 19 +++++++++++++------ modules/rental/keeper/grpc_query.go | 10 +++++----- modules/rental/keeper/msg_server.go | 4 ++-- modules/rental/keeper/rental.go | 21 +++++++++++++++++---- 4 files changed, 37 insertions(+), 17 deletions(-) diff --git a/modules/rental/keeper/genesis.go b/modules/rental/keeper/genesis.go index d895f217..11f7f808 100644 --- a/modules/rental/keeper/genesis.go +++ b/modules/rental/keeper/genesis.go @@ -7,15 +7,22 @@ import ( ) // InitGenesis stores the NFT genesis. -func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState) { - // todo: genesis validation +func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) { + if err := types.ValidateGenesis(gs); err != nil { + panic(err.Error()) + } - // todo: set rental infos - panic("Fixme") + for _, v := range gs.RenterInfos { + user, err := sdk.AccAddressFromBech32(v.User) + if err != nil { + panic(err) + } + k.SetRentalInfo(ctx, v.ClassId, v.NftId, user, v.Expires) + } } // ExportGenesis returns a GenesisState for a given context and keeper. func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - // fixme - panic("Fixme") + ris := k.GetRentalInfos(ctx) + return types.NewGenesisState(ris) } diff --git a/modules/rental/keeper/grpc_query.go b/modules/rental/keeper/grpc_query.go index 47e1d6d1..718ec31d 100644 --- a/modules/rental/keeper/grpc_query.go +++ b/modules/rental/keeper/grpc_query.go @@ -17,7 +17,7 @@ func (k Keeper) User(goCtx context.Context, msg *types.QueryUserRequest) (*types return nil, sdkerrors.Wrapf(types.ErrNotExistentNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) } - rental, exist := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) + rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) if !exist { return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) } @@ -33,7 +33,7 @@ func (k Keeper) Expires(goCtx context.Context, msg *types.QueryExpiresRequest) ( return nil, sdkerrors.Wrapf(types.ErrNotExistentNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) } - rental, exist := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) + rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) if !exist { return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) } @@ -41,8 +41,8 @@ func (k Keeper) Expires(goCtx context.Context, msg *types.QueryExpiresRequest) ( return &types.QueryExpiresResponse{Expires: rental.Expires}, nil } -// Expires queries if an nft has the user -// WARNING: it deson't check if this rental has expires +// HasUser queries if an nft has the user +// WARNING: it doesn't check if this rental has expires func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) (*types.QueryHasUserResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -50,6 +50,6 @@ func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) ( return nil, sdkerrors.Wrapf(types.ErrNotExistentNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) } - _, exist := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) + _, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) return &types.QueryHasUserResponse{HasUser: exist}, nil } diff --git a/modules/rental/keeper/msg_server.go b/modules/rental/keeper/msg_server.go index a2f03a8f..163e645b 100644 --- a/modules/rental/keeper/msg_server.go +++ b/modules/rental/keeper/msg_server.go @@ -32,13 +32,13 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms // this nft must expire if to be set again. // FIXME: proto should use int64 or Time than uint64 - rental, exist := k.getRentalInfo(ctx, msg.ClassId, msg.NftId) + rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) if exist && ctx.BlockTime().Unix() < int64(rental.Expires) { return nil, sdkerrors.Wrapf(types.ErrNotArriveExpires, "Expires is (%d)", rental.Expires) } // set rental info - k.setRentalInfo(ctx, msg.ClassId, msg.NftId, user, msg.Expires) + k.SetRentalInfo(ctx, msg.ClassId, msg.NftId, user, msg.Expires) ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( diff --git a/modules/rental/keeper/rental.go b/modules/rental/keeper/rental.go index 1825b485..b1b1ffa3 100644 --- a/modules/rental/keeper/rental.go +++ b/modules/rental/keeper/rental.go @@ -5,8 +5,8 @@ import ( "github.com/irisnet/irismod/modules/rental/types" ) -// setRentalInfo sets the rental info for an nft. -func (k Keeper) setRentalInfo(ctx sdk.Context, +// SetRentalInfo sets the rental info for an nft. +func (k Keeper) SetRentalInfo(ctx sdk.Context, classId, nftId string, user sdk.AccAddress, expires uint64) { @@ -21,8 +21,8 @@ func (k Keeper) setRentalInfo(ctx sdk.Context, store.Set(rentalInfoKey(r.ClassId, r.NftId), bz) } -// getRentalInfo returns the rental info for an nft. -func (k Keeper) getRentalInfo(ctx sdk.Context, +// GetRentalInfo returns the rental info for an nft. +func (k Keeper) GetRentalInfo(ctx sdk.Context, classId, nftId string) (types.RentalInfo, bool) { var v types.RentalInfo store := ctx.KVStore(k.storeKey) @@ -33,3 +33,16 @@ func (k Keeper) getRentalInfo(ctx sdk.Context, k.cdc.MustUnmarshal(bz, &v) return v, true } + +// GetRentalInfos returns all rental infos. +func (k Keeper) GetRentalInfos(ctx sdk.Context) (ris []types.RentalInfo) { + store := ctx.KVStore(k.storeKey) + iterator := store.Iterator(nil, nil) + defer iterator.Close() + for ; iterator.Valid(); iterator.Next() { + var rental types.RentalInfo + k.cdc.MustUnmarshal(iterator.Value(), &rental) + ris = append(ris, rental) + } + return ris +} From e14000725606e4350ac9b3ce9bd93c776190bd25 Mon Sep 17 00:00:00 2001 From: yuandu Date: Mon, 19 Dec 2022 10:38:29 +0800 Subject: [PATCH 10/20] add unit test --- modules/rental/keeper/keeper_test.go | 93 ++++++++++++++++++++++++++++ modules/rental/keeper/msg_server.go | 15 +++-- modules/rental/keeper/rental.go | 24 +++++-- simapp/app.go | 21 +++++-- 4 files changed, 136 insertions(+), 17 deletions(-) create mode 100644 modules/rental/keeper/keeper_test.go diff --git a/modules/rental/keeper/keeper_test.go b/modules/rental/keeper/keeper_test.go new file mode 100644 index 00000000..464a8b84 --- /dev/null +++ b/modules/rental/keeper/keeper_test.go @@ -0,0 +1,93 @@ +package keeper_test + +import ( + "github.com/cosmos/cosmos-sdk/x/nft" + "testing" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/irisnet/irismod/simapp" + "github.com/stretchr/testify/suite" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmtime "github.com/tendermint/tendermint/types/time" + + rental "github.com/irisnet/irismod/modules/rental/types" +) + +const ( + testClassID = "flower" + testClassName = "Crypto Flower" + testClassSymbol = "flower" + testClassDescription = "Crypto Flower" + testClassURI = "class uri" + testClassURIHash = "ae702cefd6b6a65fe2f991ad6d9969ed" + testID = "iris" + testURI = "iris uri" + testURIHash = "229bfd3c1b431c14a526497873897108" + + testAccNumber = 2 + testOwnerIdx = 0 + testUserIdx = 1 + + testExpires = "999999999999999" +) + +type TestSuite struct { + suite.Suite + + app *simapp.SimApp + ctx sdk.Context + addrs []sdk.AccAddress + + queryClient rental.QueryClient +} + +func (s *TestSuite) SetupTest() { + app := simapp.Setup(s.T(), false) + ctx := app.BaseApp.NewContext(false, tmproto.Header{}) + ctx = ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) + + queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) + rental.RegisterQueryServer(queryHelper, app.RentalKeeper) + queryClient := rental.NewQueryClient(queryHelper) + + s.app = app + s.ctx = ctx + s.queryClient = queryClient + s.addrs = simapp.AddTestAddrsIncremental(app, ctx, testAccNumber, sdk.NewInt(30000000)) + + s.prepareNFT() +} + +func TestTestSuite(t *testing.T) { + suite.Run(t, new(TestSuite)) +} + +func (s *TestSuite) TestRent() { + // s.app.RentalKeeper.Rent() +} + +// prepareNFT setups nft for rental testing +func (s *TestSuite) prepareNFT() { + testClass := nft.Class{ + Id: testClassID, + Name: testClassName, + Symbol: testClassSymbol, + Description: testClassDescription, + Uri: testClassURI, + UriHash: testClassURIHash, + } + + err := s.app.NFTKeeper.NFTkeeper().SaveClass(s.ctx, testClass) + s.Require().NoError(err) + + testNft := nft.NFT{ + ClassId: testClassID, + Id: testID, + Uri: testURI, + UriHash: testURIHash, + } + + err = s.app.NFTKeeper.NFTkeeper().Mint(s.ctx, testNft, s.addrs[testOwnerIdx]) + s.Require().NoError(err) +} diff --git a/modules/rental/keeper/msg_server.go b/modules/rental/keeper/msg_server.go index 163e645b..890a294e 100644 --- a/modules/rental/keeper/msg_server.go +++ b/modules/rental/keeper/msg_server.go @@ -30,16 +30,15 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms return nil, sdkerrors.Wrapf(types.ErrNotApprovedNorOwner, "Not owner (%s)", msg.Sender) } - // this nft must expire if to be set again. - // FIXME: proto should use int64 or Time than uint64 - rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) - if exist && ctx.BlockTime().Unix() < int64(rental.Expires) { - return nil, sdkerrors.Wrapf(types.ErrNotArriveExpires, "Expires is (%d)", rental.Expires) + if err := k.Rent(ctx, types.RentalInfo{ + User: user.String(), + ClassId: msg.ClassId, + NftId: msg.NftId, + Expires: msg.Expires, + }); err != nil { + return nil, err } - // set rental info - k.SetRentalInfo(ctx, msg.ClassId, msg.NftId, user, msg.Expires) - ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeSetUser, diff --git a/modules/rental/keeper/rental.go b/modules/rental/keeper/rental.go index b1b1ffa3..e6c66510 100644 --- a/modules/rental/keeper/rental.go +++ b/modules/rental/keeper/rental.go @@ -2,17 +2,31 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/rental/types" ) -// SetRentalInfo sets the rental info for an nft. -func (k Keeper) SetRentalInfo(ctx sdk.Context, - classId, nftId string, - user sdk.AccAddress, +// Rent set or update rental info for an nft. +func (k Keeper) Rent(ctx sdk.Context, rental types.RentalInfo) error { + // this nft must expire if to be set again. + // FIXME: proto should use int64 or Time than uint64 + rental, exist := k.GetRentalInfo(ctx, rental.ClassId, rental.NftId) + if exist && ctx.BlockTime().Unix() < int64(rental.Expires) { + return sdkerrors.Wrapf(types.ErrNotArriveExpires, "Expires is (%d)", rental.Expires) + } + + // set rental info + k.setRentalInfo(ctx, rental.ClassId, rental.NftId, rental.User, rental.Expires) + return nil +} + +// setRentalInfo sets the rental info for an nft. +func (k Keeper) setRentalInfo(ctx sdk.Context, + classId, nftId, user string, expires uint64) { store := ctx.KVStore(k.storeKey) r := types.RentalInfo{ - User: user.String(), + User: user, ClassId: classId, NftId: nftId, Expires: expires, diff --git a/simapp/app.go b/simapp/app.go index c63d0c3e..f07748f5 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -109,13 +109,15 @@ import ( "github.com/irisnet/irismod/modules/record" recordkeeper "github.com/irisnet/irismod/modules/record/keeper" recordtypes "github.com/irisnet/irismod/modules/record/types" + rentalkeeper "github.com/irisnet/irismod/modules/rental/keeper" + rental "github.com/irisnet/irismod/modules/rental/module" + rentaltypes "github.com/irisnet/irismod/modules/rental/types" "github.com/irisnet/irismod/modules/service" servicekeeper "github.com/irisnet/irismod/modules/service/keeper" servicetypes "github.com/irisnet/irismod/modules/service/types" "github.com/irisnet/irismod/modules/token" tokenkeeper "github.com/irisnet/irismod/modules/token/keeper" tokentypes "github.com/irisnet/irismod/modules/token/types" - // unnamed import of statik for swagger UI support _ "github.com/cosmos/cosmos-sdk/client/docs/statik" ) @@ -163,6 +165,7 @@ var ( oracle.AppModuleBasic{}, random.AppModuleBasic{}, farm.AppModuleBasic{}, + rental.AppModuleBasic{}, ) // module account permissions @@ -234,6 +237,7 @@ type SimApp struct { OracleKeeper oracleKeeper.Keeper RandomKeeper randomkeeper.Keeper FarmKeeper farmkeeper.Keeper + RentalKeeper rentalkeeper.Keeper // the module manager mm *module.Manager @@ -279,7 +283,7 @@ func NewSimApp( capabilitytypes.StoreKey, tokentypes.StoreKey, nfttypes.StoreKey, mttypes.StoreKey, htlctypes.StoreKey, recordtypes.StoreKey, coinswaptypes.StoreKey, servicetypes.StoreKey, oracletypes.StoreKey, - randomtypes.StoreKey, farmtypes.StoreKey, + randomtypes.StoreKey, farmtypes.StoreKey, rentaltypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -412,6 +416,12 @@ func NewSimApp( distrtypes.ModuleName, ) + // rental needs only x/nft keeper from app/nft + app.RentalKeeper = rentalkeeper.NewKeeper(appCodec, + keys[rentaltypes.StoreKey], + app.NFTKeeper.NFTkeeper(), + ) + // register the proposal types govRouter := govv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). @@ -467,6 +477,7 @@ func NewSimApp( oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), random.NewAppModule(appCodec, app.RandomKeeper, app.AccountKeeper, app.BankKeeper), farm.NewAppModule(appCodec, app.FarmKeeper, app.AccountKeeper, app.BankKeeper), + rental.NewAppModule(appCodec, app.RentalKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -483,7 +494,7 @@ func NewSimApp( nfttypes.ModuleName, mttypes.ModuleName, htlctypes.ModuleName, recordtypes.ModuleName, coinswaptypes.ModuleName, servicetypes.ModuleName, oracletypes.ModuleName, - randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, + randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, rentaltypes.ModuleName, ) app.mm.SetOrderEndBlockers( capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, @@ -495,7 +506,7 @@ func NewSimApp( nfttypes.ModuleName, mttypes.ModuleName, htlctypes.ModuleName, recordtypes.ModuleName, coinswaptypes.ModuleName, servicetypes.ModuleName, oracletypes.ModuleName, - randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, + randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, rentaltypes.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -514,6 +525,7 @@ func NewSimApp( htlctypes.ModuleName, recordtypes.ModuleName, coinswaptypes.ModuleName, servicetypes.ModuleName, oracletypes.ModuleName, randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, crisistypes.ModuleName, + rentaltypes.ModuleName, ) app.mm.RegisterInvariants(&app.CrisisKeeper) @@ -546,6 +558,7 @@ func NewSimApp( //oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), //random.NewAppModule(appCodec, app.RandomKeeper, app.AccountKeeper, app.BankKeeper), //farm.NewAppModule(appCodec, app.FarmKeeper, app.AccountKeeper, app.BankKeeper), + rental.NewAppModule(appCodec, app.RentalKeeper), ) app.sm.RegisterStoreDecoders() From 8f174df6cf7809800bbb9c81cb08915e28281ac3 Mon Sep 17 00:00:00 2001 From: yuandu Date: Mon, 19 Dec 2022 14:11:30 +0800 Subject: [PATCH 11/20] move rental under nft --- modules/mt/types/tx.pb.go | 17 +- .../keeper/grpc_query_rental.go} | 16 +- modules/{rental => nft}/keeper/keys.go | 30 +- .../keeper/msg_server_rental.go} | 10 +- modules/{rental => nft}/keeper/rental.go | 4 +- modules/nft/types/errors.go | 4 + modules/nft/types/events.go | 4 + modules/nft/types/nft.pb.go | 119 +- modules/nft/types/query.pb.go | 1409 +++++++++++++++- modules/nft/types/query.pb.gw.go | 369 +++++ modules/{rental => nft}/types/rental.pb.go | 38 +- modules/nft/types/tx.pb.go | 618 ++++++- modules/rental/client/cli/query.go | 8 - modules/rental/client/cli/tx.go | 8 - modules/rental/keeper/genesis.go | 28 - modules/rental/keeper/keeper.go | 22 - modules/rental/keeper/keeper_test.go | 93 -- modules/rental/module/module.go | 176 -- modules/rental/simulation/decoder.go | 12 - modules/rental/simulation/genesis.go | 8 - modules/rental/simulation/operations.go | 20 - modules/rental/types/codec.go | 33 - modules/rental/types/errors.go | 13 - modules/rental/types/events.go | 14 - modules/rental/types/expected_keepers.go | 1 - modules/rental/types/genesis.go | 54 - modules/rental/types/genesis.pb.go | 330 ---- modules/rental/types/key.go | 15 - modules/rental/types/msgs.go | 72 - modules/rental/types/query.pb.go | 1413 ----------------- modules/rental/types/query.pb.gw.go | 457 ------ modules/rental/types/tx.pb.go | 684 -------- proto/nft/nft.proto | 3 + proto/nft/query.proto | 50 +- proto/{rental => nft}/rental.proto | 2 +- proto/nft/tx.proto | 17 + proto/rental/genesis.proto | 12 - proto/rental/query.proto | 51 - proto/rental/tx.proto | 25 - 39 files changed, 2475 insertions(+), 3784 deletions(-) rename modules/{rental/keeper/grpc_query.go => nft/keeper/grpc_query_rental.go} (64%) rename modules/{rental => nft}/keeper/keys.go (51%) rename modules/{rental/keeper/msg_server.go => nft/keeper/msg_server_rental.go} (81%) rename modules/{rental => nft}/keeper/rental.go (92%) rename modules/{rental => nft}/types/rental.pb.go (85%) delete mode 100644 modules/rental/client/cli/query.go delete mode 100644 modules/rental/client/cli/tx.go delete mode 100644 modules/rental/keeper/genesis.go delete mode 100644 modules/rental/keeper/keeper.go delete mode 100644 modules/rental/keeper/keeper_test.go delete mode 100644 modules/rental/module/module.go delete mode 100644 modules/rental/simulation/decoder.go delete mode 100644 modules/rental/simulation/genesis.go delete mode 100644 modules/rental/simulation/operations.go delete mode 100644 modules/rental/types/codec.go delete mode 100644 modules/rental/types/errors.go delete mode 100644 modules/rental/types/events.go delete mode 100644 modules/rental/types/expected_keepers.go delete mode 100644 modules/rental/types/genesis.go delete mode 100644 modules/rental/types/genesis.pb.go delete mode 100644 modules/rental/types/key.go delete mode 100644 modules/rental/types/msgs.go delete mode 100644 modules/rental/types/query.pb.go delete mode 100644 modules/rental/types/query.pb.gw.go delete mode 100644 modules/rental/types/tx.pb.go rename proto/{rental => nft}/rental.proto (75%) delete mode 100644 proto/rental/genesis.proto delete mode 100644 proto/rental/query.proto delete mode 100644 proto/rental/tx.proto diff --git a/modules/mt/types/tx.pb.go b/modules/mt/types/tx.pb.go index 4631a428..44a3eb7c 100644 --- a/modules/mt/types/tx.pb.go +++ b/modules/mt/types/tx.pb.go @@ -7,16 +7,15 @@ import ( bytes "bytes" context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/gogo/protobuf/gogoproto" 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" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -70,7 +69,7 @@ func (m *MsgIssueDenom) XXX_DiscardUnknown() { var xxx_messageInfo_MsgIssueDenom proto.InternalMessageInfo -// MsgIssueDenomResponse defines the Msg/SaveDenom response type. +// MsgIssueDenomResponse defines the Msg/IssueDenom response type. type MsgIssueDenomResponse struct { } @@ -792,7 +791,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) IssueDenom(ctx context.Context, in *MsgIssueDenom, opts ...grpc.CallOption) (*MsgIssueDenomResponse, error) { out := new(MsgIssueDenomResponse) - err := c.cc.Invoke(ctx, "/irismod.mt.Msg/SaveDenom", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.mt.Msg/IssueDenom", in, out, opts...) if err != nil { return nil, err } @@ -866,7 +865,7 @@ type UnimplementedMsgServer struct { } func (*UnimplementedMsgServer) IssueDenom(ctx context.Context, req *MsgIssueDenom) (*MsgIssueDenomResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SaveDenom not implemented") + return nil, status.Errorf(codes.Unimplemented, "method IssueDenom not implemented") } func (*UnimplementedMsgServer) TransferDenom(ctx context.Context, req *MsgTransferDenom) (*MsgTransferDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferDenom not implemented") @@ -898,7 +897,7 @@ func _Msg_IssueDenom_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.mt.Msg/SaveDenom", + FullMethod: "/irismod.mt.Msg/IssueDenom", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).IssueDenom(ctx, req.(*MsgIssueDenom)) @@ -1001,7 +1000,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "SaveDenom", + MethodName: "IssueDenom", Handler: _Msg_IssueDenom_Handler, }, { diff --git a/modules/rental/keeper/grpc_query.go b/modules/nft/keeper/grpc_query_rental.go similarity index 64% rename from modules/rental/keeper/grpc_query.go rename to modules/nft/keeper/grpc_query_rental.go index 718ec31d..282208c6 100644 --- a/modules/rental/keeper/grpc_query.go +++ b/modules/nft/keeper/grpc_query_rental.go @@ -4,17 +4,17 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/irisnet/irismod/modules/rental/types" + "github.com/irisnet/irismod/modules/nft/types" ) var _ types.QueryServer = Keeper{} // User queries the user of an nft -func (k Keeper) User(goCtx context.Context, msg *types.QueryUserRequest) (*types.QueryUserResponse, error) { +func (k Keeper) UserOf(goCtx context.Context, msg *types.QueryUserOfRequest) (*types.QueryUserOfResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrNotExistentNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) } rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) @@ -22,15 +22,15 @@ func (k Keeper) User(goCtx context.Context, msg *types.QueryUserRequest) (*types return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) } - return &types.QueryUserResponse{User: rental.User}, nil + return &types.QueryUserOfResponse{User: rental.User}, nil } // Expires queries the expires of an nft -func (k Keeper) Expires(goCtx context.Context, msg *types.QueryExpiresRequest) (*types.QueryExpiresResponse, error) { +func (k Keeper) UserExpires(goCtx context.Context, msg *types.QueryUserExpiresRequest) (*types.QueryUserExpiresResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrNotExistentNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) } rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) @@ -38,7 +38,7 @@ func (k Keeper) Expires(goCtx context.Context, msg *types.QueryExpiresRequest) ( return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) } - return &types.QueryExpiresResponse{Expires: rental.Expires}, nil + return &types.QueryUserExpiresResponse{Expires: rental.Expires}, nil } // HasUser queries if an nft has the user @@ -47,7 +47,7 @@ func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) ( ctx := sdk.UnwrapSDKContext(goCtx) if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrNotExistentNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) } _, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) diff --git a/modules/rental/keeper/keys.go b/modules/nft/keeper/keys.go similarity index 51% rename from modules/rental/keeper/keys.go rename to modules/nft/keeper/keys.go index e77c3a52..9e4eaba1 100644 --- a/modules/rental/keeper/keys.go +++ b/modules/nft/keeper/keys.go @@ -1,33 +1,33 @@ package keeper import ( - "github.com/irisnet/irismod/modules/rental/types" "reflect" "unsafe" ) +// As iris/nft uses x/nft as its base module, new added key must start from 0x06. +// Key of each plugin must add an PrefixPluginXxx to distinguish. var ( + PluginRental = []byte{0x06} + RentalInfoKey = []byte{0x01} Delimiter = []byte{0x00} ) -// StoreKey is the store key for rental module -const StoreKey = types.ModuleName - // rentalInfoKey returns the byte representation of the rental info key. -// This key comprises of <0x01> +// This key comprises of <0x06><0x01> func rentalInfoKey(classId, nftId string) []byte { classIdBz := unsafeStrToBytes(classId) nftIdBz := unsafeStrToBytes(nftId) - key := make([]byte, len(RentalInfoKey)+len(classIdBz)+len(Delimiter)+len(nftIdBz)) - - copy(key, RentalInfoKey) - copy(key[len(RentalInfoKey):], classIdBz) - copy(key[len(RentalInfoKey)+len(classIdBz):], Delimiter) - copy(key[len(RentalInfoKey)+len(classIdBz)+len(Delimiter):], nftIdBz) + key := make([]byte, len(PluginRental)+len(RentalInfoKey)+len(classIdBz)+len(Delimiter)+len(nftIdBz)) + copy(key, PluginRental) + copy(key[len(PluginRental):], RentalInfoKey) + copy(key[len(PluginRental)+len(RentalInfoKey):], classIdBz) + copy(key[len(PluginRental)+len(RentalInfoKey)+len(classIdBz):], Delimiter) + copy(key[len(PluginRental)+len(RentalInfoKey)+len(classIdBz)+len(Delimiter):], nftIdBz) return key } @@ -44,11 +44,3 @@ func unsafeStrToBytes(s string) []byte { bufHdr.Len = sHdr.Len return buf } - -// unsafeBytesToStr is meant to make a zero allocation conversion -// from []byte -> string to speed up operations, it is not meant -// to be used generally, but for a specific pattern to delete keys -// from a map. -func unsafeBytesToStr(b []byte) string { - return *(*string)(unsafe.Pointer(&b)) -} diff --git a/modules/rental/keeper/msg_server.go b/modules/nft/keeper/msg_server_rental.go similarity index 81% rename from modules/rental/keeper/msg_server.go rename to modules/nft/keeper/msg_server_rental.go index 890a294e..27ed44e0 100644 --- a/modules/rental/keeper/msg_server.go +++ b/modules/nft/keeper/msg_server_rental.go @@ -6,11 +6,9 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "strconv" - "github.com/irisnet/irismod/modules/rental/types" + "github.com/irisnet/irismod/modules/nft/types" ) -var _ types.MsgServer = Keeper{} - // SetUser set a user and expires time for an existent nft func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.MsgSetUserResponse, error) { sender, err := sdk.AccAddressFromBech32(msg.Sender) @@ -27,7 +25,7 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms // sender must own or be approved for this nft if owner := k.nk.GetOwner(ctx, msg.ClassId, msg.NftId); !owner.Equals(sender) { - return nil, sdkerrors.Wrapf(types.ErrNotApprovedNorOwner, "Not owner (%s)", msg.Sender) + return nil, sdkerrors.Wrapf(types.ErrUnauthorized, "%s is not owner of the nft", msg.Sender) } if err := k.Rent(ctx, types.RentalInfo{ @@ -42,8 +40,8 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeSetUser, - sdk.NewAttribute(types.AttributeKeyClassId, msg.ClassId), - sdk.NewAttribute(types.AttributeKeyNftId, msg.NftId), + sdk.NewAttribute(types.AttributeKeyDenomID, msg.ClassId), + sdk.NewAttribute(types.AttributeKeyTokenID, msg.NftId), sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatUint(msg.Expires, 10)), sdk.NewAttribute(types.AttributeKeyUser, msg.User), ), diff --git a/modules/rental/keeper/rental.go b/modules/nft/keeper/rental.go similarity index 92% rename from modules/rental/keeper/rental.go rename to modules/nft/keeper/rental.go index e6c66510..88738d3a 100644 --- a/modules/rental/keeper/rental.go +++ b/modules/nft/keeper/rental.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/irisnet/irismod/modules/rental/types" + "github.com/irisnet/irismod/modules/nft/types" ) // Rent set or update rental info for an nft. @@ -12,7 +12,7 @@ func (k Keeper) Rent(ctx sdk.Context, rental types.RentalInfo) error { // FIXME: proto should use int64 or Time than uint64 rental, exist := k.GetRentalInfo(ctx, rental.ClassId, rental.NftId) if exist && ctx.BlockTime().Unix() < int64(rental.Expires) { - return sdkerrors.Wrapf(types.ErrNotArriveExpires, "Expires is (%d)", rental.Expires) + return sdkerrors.Wrapf(types.ErrInvalidExpiry, "Expiry is (%d)", rental.Expires) } // set rental info diff --git a/modules/nft/types/errors.go b/modules/nft/types/errors.go index e5f77082..1f33e8af 100644 --- a/modules/nft/types/errors.go +++ b/modules/nft/types/errors.go @@ -15,4 +15,8 @@ var ( ErrInvalidDenom = sdkerrors.Register(ModuleName, 16, "invalid denom") ErrInvalidTokenID = sdkerrors.Register(ModuleName, 17, "invalid nft id") ErrInvalidTokenURI = sdkerrors.Register(ModuleName, 18, "invalid nft uri") + + // Renal Plugin Errors + ErrInvalidExpiry = sdkerrors.Register(ModuleName, 31, "invalid expiry") + ErrNotExistentRentalInfo = sdkerrors.Register(ModuleName, 32, "rental info is not existent") ) diff --git a/modules/nft/types/events.go b/modules/nft/types/events.go index 2903321e..7c925b48 100644 --- a/modules/nft/types/events.go +++ b/modules/nft/types/events.go @@ -8,6 +8,7 @@ var ( EventTypeMintNFT = "mint_nft" EventTypeBurnNFT = "burn_nft" EventTypeTransferDenom = "transfer_denom" + EventTypeSetUser = "set_user" AttributeValueCategory = ModuleName @@ -19,4 +20,7 @@ var ( AttributeKeyTokenURI = "token_uri" AttributeKeyDenomID = "denom_id" AttributeKeyDenomName = "denom_name" + + AttributeKeyUser = "user" + AttributeKeyExpires = "expires" ) diff --git a/modules/nft/types/nft.pb.go b/modules/nft/types/nft.pb.go index db8953af..78465300 100644 --- a/modules/nft/types/nft.pb.go +++ b/modules/nft/types/nft.pb.go @@ -158,6 +158,8 @@ type DenomMetadata struct { MintRestricted bool `protobuf:"varint,3,opt,name=mint_restricted,json=mintRestricted,proto3" json:"mint_restricted,omitempty"` UpdateRestricted bool `protobuf:"varint,4,opt,name=update_restricted,json=updateRestricted,proto3" json:"update_restricted,omitempty"` Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` + // rental options + RentalEnabled bool `protobuf:"varint,7,opt,name=rental_enabled,json=rentalEnabled,proto3" json:"rental_enabled,omitempty"` } func (m *DenomMetadata) Reset() { *m = DenomMetadata{} } @@ -323,47 +325,48 @@ func init() { func init() { proto.RegisterFile("nft/nft.proto", fileDescriptor_fe8ab7e15b7f0646) } var fileDescriptor_fe8ab7e15b7f0646 = []byte{ - // 635 bytes of a gzipped FileDescriptorProto + // 654 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0x8e, 0x1d, 0xa7, 0x4e, 0xc6, 0x4d, 0xdb, 0x7f, 0xff, 0x08, 0xb9, 0x1c, 0xec, 0x2a, 0x42, - 0xa2, 0x12, 0x28, 0x11, 0x45, 0xe2, 0x50, 0x6e, 0xa6, 0xaa, 0x08, 0x12, 0x45, 0xb2, 0xca, 0x85, - 0x4b, 0xb4, 0xf5, 0x6e, 0x9a, 0x15, 0xb1, 0x37, 0xda, 0xdd, 0x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, 0x30, 0xcc, 0xb1, 0x9c, 0x4e, 0xb0, + 0xc4, 0xae, 0xa5, 0xe9, 0x79, 0x8c, 0xba, 0xd0, 0xe0, 0x67, 0x29, 0xcd, 0xdc, 0x86, 0x02, 0x75, + 0x82, 0x76, 0xa0, 0x39, 0xcf, 0xd8, 0x68, 0x8a, 0xc5, 0xd4, 0xdd, 0x50, 0x05, 0x7b, 0x9e, 0xb1, + 0xd7, 0x58, 0x4c, 0x0f, 0xac, 0x5f, 0xdf, 0x7c, 0xa3, 0xf7, 0x02, 0x9c, 0xe3, 0xa3, 0x93, 0xb7, + 0x54, 0x62, 0x75, 0x4b, 0x29, 0xc4, 0xa8, 0x08, 0x29, 0xbb, 0x99, 0x7f, 0xba, 0x15, 0x87, 0xbf, + 0x9b, 0xd0, 0x38, 0xa4, 0x29, 0x4f, 0xee, 0x34, 0xd0, 0x3d, 0xd8, 0x10, 0xd1, 0x94, 0x26, 0x58, + 0xcf, 0x14, 0x16, 0x19, 0x72, 0xc1, 0x8e, 0x32, 0x8a, 0x25, 0xcf, 0x8a, 0x81, 0xca, 0x54, 0x9d, + 0x38, 0x4f, 0xc6, 0x3c, 0x2e, 0x86, 0x2a, 0x32, 0xf4, 0x08, 0xb6, 0x12, 0x96, 0xca, 0x51, 0x46, + 0x85, 0xcc, 0x58, 0x24, 0x29, 0x51, 0xc3, 0x35, 0xc3, 0x4e, 0x0e, 0x87, 0x2b, 0x14, 0x3d, 0x86, + 0xff, 0xe6, 0x33, 0x82, 0x25, 0xad, 0x52, 0x6d, 0x45, 0xdd, 0xd6, 0x85, 0x0a, 0x79, 0x17, 0x1c, + 0x42, 0x45, 0x94, 0xb1, 0x99, 0x64, 0x3c, 0x75, 0x9b, 0xaa, 0x65, 0x15, 0x42, 0xdb, 0xfa, 0x93, + 0xb4, 0x54, 0x45, 0x7d, 0x89, 0xaa, 0xbf, 0xb0, 0xe6, 0xef, 0xca, 0x36, 0xe7, 0x96, 0x6d, 0x57, + 0x06, 0xb4,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6, 0x8c, 0x68, 0xa8, 0x19, 0x95, 0x26, 0x67, 0x1f, 0xad, + 0xb5, 0x54, 0xcb, 0x10, 0x58, 0x79, 0xaf, 0x50, 0xd3, 0xd0, 0x73, 0xb0, 0xd2, 0x89, 0x2c, 0x15, + 0x76, 0xd7, 0xe8, 0xc5, 0x2b, 0x12, 0x6c, 0x16, 0xe2, 0xac, 0xe3, 0xa3, 0x13, 0x11, 0x2a, 0xbe, + 0xee, 0x1d, 0xbc, 0xb9, 0xf8, 0xe9, 0xd5, 0x2e, 0x96, 0x9e, 0x71, 0xb9, 0xf4, 0x8c, 0x1f, 0x4b, + 0xcf, 0xf8, 0x72, 0xed, 0xd5, 0x2e, 0xaf, 0xbd, 0xda, 0xd5, 0xb5, 0x57, 0xfb, 0xf0, 0xe4, 0x94, + 0xc9, 0xe9, 0x7c, 0xdc, 0x8f, 0x78, 0x32, 0xc8, 0xef, 0x4d, 0xa9, 0x1c, 0x14, 0xf7, 0x0f, 0x12, + 0x4e, 0xe6, 0x31, 0x15, 0xf9, 0xd3, 0x36, 0x90, 0xe7, 0x33, 0x2a, 0xc6, 0x1b, 0xea, 0xf9, 0x7a, + 0xf6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x99, 0x65, 0x62, 0xa1, 0xf2, 0x04, 0x00, 0x00, } func (this *BaseNFT) Equal(that interface{}) bool { @@ -520,6 +523,9 @@ func (this *DenomMetadata) Equal(that interface{}) bool { if this.Data != that1.Data { return false } + if this.RentalEnabled != that1.RentalEnabled { + return false + } return true } func (this *IDCollection) Equal(that interface{}) bool { @@ -846,6 +852,16 @@ func (m *DenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.RentalEnabled { + i-- + if m.RentalEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x38 + } if len(m.Data) > 0 { i -= len(m.Data) copy(dAtA[i:], m.Data) @@ -1156,6 +1172,9 @@ func (m *DenomMetadata) Size() (n int) { if l > 0 { n += 1 + l + sovNft(uint64(l)) } + if m.RentalEnabled { + n += 2 + } return n } @@ -2119,6 +2138,26 @@ func (m *DenomMetadata) Unmarshal(dAtA []byte) error { } m.Data = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RentalEnabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.RentalEnabled = bool(v != 0) default: iNdEx = preIndex skippy, err := skipNft(dAtA[iNdEx:]) diff --git a/modules/nft/types/query.pb.go b/modules/nft/types/query.pb.go index 3c8f197f..c9a25f5e 100644 --- a/modules/nft/types/query.pb.go +++ b/modules/nft/types/query.pb.go @@ -641,6 +641,300 @@ func (m *QueryNFTResponse) GetNFT() *BaseNFT { return nil } +// QueryUserOfRequest is the request type for the Query/Renter RPC method +type QueryUserOfRequest struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +} + +func (m *QueryUserOfRequest) Reset() { *m = QueryUserOfRequest{} } +func (m *QueryUserOfRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUserOfRequest) ProtoMessage() {} +func (*QueryUserOfRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{12} +} +func (m *QueryUserOfRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserOfRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserOfRequest.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 *QueryUserOfRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserOfRequest.Merge(m, src) +} +func (m *QueryUserOfRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryUserOfRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserOfRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserOfRequest proto.InternalMessageInfo + +func (m *QueryUserOfRequest) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *QueryUserOfRequest) GetNftId() string { + if m != nil { + return m.NftId + } + return "" +} + +// QueryUserOfResponse is the response type for the Query/Renter RPC method +type QueryUserOfResponse struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (m *QueryUserOfResponse) Reset() { *m = QueryUserOfResponse{} } +func (m *QueryUserOfResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUserOfResponse) ProtoMessage() {} +func (*QueryUserOfResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{13} +} +func (m *QueryUserOfResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserOfResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserOfResponse.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 *QueryUserOfResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserOfResponse.Merge(m, src) +} +func (m *QueryUserOfResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryUserOfResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserOfResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserOfResponse proto.InternalMessageInfo + +func (m *QueryUserOfResponse) GetUser() string { + if m != nil { + return m.User + } + return "" +} + +// QueryExpiresRequest is the request type for the Query/Expires RPC method +type QueryUserExpiresRequest struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +} + +func (m *QueryUserExpiresRequest) Reset() { *m = QueryUserExpiresRequest{} } +func (m *QueryUserExpiresRequest) String() string { return proto.CompactTextString(m) } +func (*QueryUserExpiresRequest) ProtoMessage() {} +func (*QueryUserExpiresRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{14} +} +func (m *QueryUserExpiresRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserExpiresRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserExpiresRequest.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 *QueryUserExpiresRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserExpiresRequest.Merge(m, src) +} +func (m *QueryUserExpiresRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryUserExpiresRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserExpiresRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserExpiresRequest proto.InternalMessageInfo + +func (m *QueryUserExpiresRequest) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *QueryUserExpiresRequest) GetNftId() string { + if m != nil { + return m.NftId + } + return "" +} + +// QueryExpiresResponse is the response type for the Query/Expires RPC method +type QueryUserExpiresResponse struct { + Expires uint64 `protobuf:"varint,1,opt,name=expires,proto3" json:"expires,omitempty"` +} + +func (m *QueryUserExpiresResponse) Reset() { *m = QueryUserExpiresResponse{} } +func (m *QueryUserExpiresResponse) String() string { return proto.CompactTextString(m) } +func (*QueryUserExpiresResponse) ProtoMessage() {} +func (*QueryUserExpiresResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{15} +} +func (m *QueryUserExpiresResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryUserExpiresResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryUserExpiresResponse.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 *QueryUserExpiresResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryUserExpiresResponse.Merge(m, src) +} +func (m *QueryUserExpiresResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryUserExpiresResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryUserExpiresResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryUserExpiresResponse proto.InternalMessageInfo + +func (m *QueryUserExpiresResponse) GetExpires() uint64 { + if m != nil { + return m.Expires + } + return 0 +} + +// QueryHasUserRequest is the request type for the Query/HasUser RPC method +type QueryHasUserRequest struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` +} + +func (m *QueryHasUserRequest) Reset() { *m = QueryHasUserRequest{} } +func (m *QueryHasUserRequest) String() string { return proto.CompactTextString(m) } +func (*QueryHasUserRequest) ProtoMessage() {} +func (*QueryHasUserRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{16} +} +func (m *QueryHasUserRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHasUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHasUserRequest.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 *QueryHasUserRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHasUserRequest.Merge(m, src) +} +func (m *QueryHasUserRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryHasUserRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHasUserRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHasUserRequest proto.InternalMessageInfo + +func (m *QueryHasUserRequest) GetClassId() string { + if m != nil { + return m.ClassId + } + return "" +} + +func (m *QueryHasUserRequest) GetNftId() string { + if m != nil { + return m.NftId + } + return "" +} + +// QueryHasUserResponse is the response type for the Query/HasUser RPC method +type QueryHasUserResponse struct { + HasUser bool `protobuf:"varint,1,opt,name=has_user,json=hasUser,proto3" json:"has_user,omitempty"` +} + +func (m *QueryHasUserResponse) Reset() { *m = QueryHasUserResponse{} } +func (m *QueryHasUserResponse) String() string { return proto.CompactTextString(m) } +func (*QueryHasUserResponse) ProtoMessage() {} +func (*QueryHasUserResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_ce02d034d3adf2e9, []int{17} +} +func (m *QueryHasUserResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryHasUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryHasUserResponse.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 *QueryHasUserResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryHasUserResponse.Merge(m, src) +} +func (m *QueryHasUserResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryHasUserResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryHasUserResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryHasUserResponse proto.InternalMessageInfo + +func (m *QueryHasUserResponse) GetHasUser() bool { + if m != nil { + return m.HasUser + } + return false +} + func init() { proto.RegisterType((*QuerySupplyRequest)(nil), "irismod.nft.QuerySupplyRequest") proto.RegisterType((*QuerySupplyResponse)(nil), "irismod.nft.QuerySupplyResponse") @@ -654,61 +948,81 @@ func init() { proto.RegisterType((*QueryDenomsResponse)(nil), "irismod.nft.QueryDenomsResponse") proto.RegisterType((*QueryNFTRequest)(nil), "irismod.nft.QueryNFTRequest") proto.RegisterType((*QueryNFTResponse)(nil), "irismod.nft.QueryNFTResponse") + proto.RegisterType((*QueryUserOfRequest)(nil), "irismod.nft.QueryUserOfRequest") + proto.RegisterType((*QueryUserOfResponse)(nil), "irismod.nft.QueryUserOfResponse") + proto.RegisterType((*QueryUserExpiresRequest)(nil), "irismod.nft.QueryUserExpiresRequest") + proto.RegisterType((*QueryUserExpiresResponse)(nil), "irismod.nft.QueryUserExpiresResponse") + proto.RegisterType((*QueryHasUserRequest)(nil), "irismod.nft.QueryHasUserRequest") + proto.RegisterType((*QueryHasUserResponse)(nil), "irismod.nft.QueryHasUserResponse") } func init() { proto.RegisterFile("nft/query.proto", fileDescriptor_ce02d034d3adf2e9) } var fileDescriptor_ce02d034d3adf2e9 = []byte{ - // 772 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x4f, 0x4f, 0x13, 0x41, - 0x1c, 0xed, 0xb4, 0xb4, 0xe0, 0xa0, 0x01, 0xa6, 0x08, 0xb5, 0xe2, 0xb6, 0x59, 0xfe, 0x8a, 0xb8, - 0x2b, 0x78, 0x30, 0xf1, 0xe0, 0xa1, 0x98, 0x1a, 0x2e, 0xa0, 0x95, 0x13, 0x31, 0x31, 0xdb, 0x76, - 0x5a, 0x1a, 0xbb, 0x33, 0x4b, 0x67, 0x56, 0xd3, 0x10, 0x62, 0x62, 0xbc, 0x9a, 0x90, 0x78, 0xf4, - 0x93, 0xf8, 0x0d, 0x38, 0x92, 0x78, 0xd0, 0x53, 0x63, 0x8a, 0x9f, 0x80, 0x4f, 0x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ff, 0x11, 0x02, 0x72, 0x60, 0x52, 0x5c, 0x50, 0xa4, 0x45, 0xb9, 0x83, 0xad, 0x9c, 0xcd, 0x0d, - 0x5c, 0x57, 0xb2, 0x4b, 0x42, 0x36, 0x8f, 0xb4, 0x90, 0xac, 0xbc, 0xf0, 0x41, 0xc5, 0x7d, 0x98, - 0x92, 0xfd, 0x83, 0x06, 0x51, 0xb2, 0x4b, 0x0a, 0x1e, 0x6e, 0x3d, 0xfd, 0xae, 0x10, 0xbd, 0x8d, - 0xd2, 0x7d, 0x44, 0x11, 0x83, 0xde, 0x85, 0x43, 0x73, 0x7d, 0x6b, 0xe5, 0x6b, 0xdc, 0x1b, 0xb0, - 0xaa, 0x04, 0x4c, 0x21, 0x70, 0x1f, 0x2d, 0x47, 0x2a, 0x18, 0xbc, 0x4a, 0x87, 0x7e, 0x9f, 0x1c, - 0x15, 0x8a, 0x27, 0x5d, 0x0d, 0x9c, 0x76, 0x35, 0xf0, 0xbb, 0xab, 0x81, 0xe3, 0x33, 0x2d, 0x76, - 0x7a, 0xa6, 0xc5, 0x7e, 0x9d, 0x69, 0xb1, 0xbd, 0xb5, 0x7a, 0x83, 0xef, 0xbb, 0x65, 0xa3, 0x42, - 0x6d, 0x41, 0x46, 0x30, 0xbf, 0x20, 0xb5, 0x69, 0xd5, 0x6d, 0x62, 0x26, 0xc8, 0x79, 0xdb, 0xc1, - 0xac, 0x9c, 0x12, 0xbf, 0x17, 0x8f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x30, 0x83, 0x65, 0x31, - 0xed, 0x08, 0x00, 0x00, + // 996 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xe6, 0x87, 0xed, 0xbe, 0x80, 0xd2, 0x4e, 0xd2, 0xd6, 0x31, 0xc5, 0x36, 0xd3, 0x36, + 0x4d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0x63, 0x80, 0xd6, 0x78, + 0x16, 0xd3, 0x74, 0x3d, 0x91, 0xa6, 0xd8, 0xa6, 0x18, 0xf4, 0xdd, 0x25, 0x6c, 0x0b, 0xae, 0x68, + 0x71, 0x9f, 0x85, 0xa7, 0xce, 0x99, 0x2a, 0xfa, 0x29, 0x36, 0x13, 0x06, 0x99, 0x94, 0x5f, 0x03, + 0x32, 0xcb, 0x6f, 0xa0, 0x06, 0x40, 0xbf, 0x8b, 0xef, 0x97, 0x91, 0x8a, 0x64, 0x01, 0xac, 0xdc, + 0x05, 0x38, 0xb2, 0xb0, 0x1f, 0xa3, 0xf0, 0xa8, 0xef, 0x01, 0x14, 0x34, 0xbd, 0x2c, 0x5b, 0xf5, + 0x99, 0x6c, 0x81, 0x8d, 0xd9, 0x97, 0xc7, 0xb5, 0x29, 0x17, 0x71, 0xef, 0x2e, 0xeb, 0xfb, 0xb0, + 0x10, 0x75, 0x4d, 0xde, 0xeb, 0x69, 0x43, 0x49, 0x89, 0xef, 0x19, 0x0f, 0xf1, 0xd3, 0x67, 0xf1, + 0xd1, 0x0a, 0x75, 0x8b, 0xfa, 0x73, 0xbb, 0x4d, 0xb7, 0xe0, 0xf2, 0x84, 0x12, 0x33, 0xe0, 0xc0, + 0x0c, 0xf7, 0x15, 0xa6, 0x76, 0x29, 0x71, 0xfc, 0x86, 0x27, 0xd9, 0x93, 0xe6, 0xd3, 0x46, 0xf1, + 0xe4, 0xb8, 0x36, 0x13, 0xee, 0x09, 0x91, 0xb4, 0x89, 0x85, 0xfa, 0x56, 0xb2, 0xc1, 0x8e, 0x1f, + 0x49, 0x5f, 0x86, 0x52, 0xab, 0xe7, 0x49, 0x39, 0x96, 0xee, 0x16, 0xf5, 0x78, 0xbb, 0x4d, 0xae, + 0x42, 0x81, 0xfb, 0x6a, 0xac, 0xd1, 0x9d, 0xe3, 0xbe, 0xda, 0x6e, 0xd3, 0xbb, 0x58, 0x91, 0x28, + 0x0e, 0xea, 0x21, 0x30, 0x3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x3a, 0xd2, 0xae, 0x68, 0xda, + 0x3a, 0xa9, 0x26, 0x68, 0x8d, 0xc5, 0xc4, 0x19, 0xf7, 0xa0, 0x60, 0x1c, 0x8b, 0x9c, 0x17, 0x52, + 0x5e, 0x50, 0xf0, 0xa4, 0xd9, 0xd1, 0x0f, 0x34, 0xe9, 0x55, 0xb2, 0x98, 0x41, 0x4a, 0x24, 0x84, + 0x2d, 0x4e, 0x6e, 0x64, 0xd6, 0x2a, 0xe2, 0xf8, 0xf0, 0x9c, 0x55, 0x24, 0x70, 0x34, 0xc1, 0x5d, + 0x72, 0x27, 0x55, 0xc1, 0xf8, 0x55, 0x3a, 0x8c, 0x9c, 0x69, 0x44, 0x46, 0x50, 0x30, 0xed, 0x9f, + 0x75, 0xbc, 0x84, 0xc1, 0x64, 0x1d, 0x2f, 0xe9, 0x1c, 0xf4, 0x81, 0x66, 0x5f, 0x23, 0xab, 0x63, + 0xf6, 0x01, 0xe3, 0xca, 0xeb, 0x39, 0x61, 0x4f, 0x39, 0x87, 0x51, 0x9f, 0x8e, 0x9c, 0x43, 0xd3, + 0x97, 0x23, 0xf2, 0x9b, 0x05, 0xf3, 0x31, 0x1b, 0xc8, 0xba, 0xce, 0x69, 0xcb, 0xc9, 0xba, 0xce, + 0x19, 0x5e, 0x42, 0x1f, 0x6a, 0x39, 0xf7, 0xc9, 0xbd, 0xb3, 0x72, 0xd0, 0x52, 0x32, 0x15, 0xbd, + 0xb0, 0xa0, 0x88, 0xce, 0x40, 0x32, 0x4e, 0x9c, 0x74, 0x9f, 0xca, 0x47, 0x17, 0x20, 0x50, 0xc5, + 0x23, 0xad, 0xc2, 0x26, 0xeb, 0x67, 0x55, 0x44, 0x66, 0x93, 0x25, 0xa3, 0xd1, 0x7c, 0x79, 0x52, + 0xb5, 0x5e, 0x9d, 0x54, 0xad, 0x7f, 0x4e, 0xaa, 0xd6, 0xd1, 0x69, 0x75, 0xea, 0xd5, 0x69, 0x75, + 0xea, 0xef, 0xd3, 0xea, 0xd4, 0xb3, 0xf5, 0x4e, 0x57, 0xed, 0x0d, 0x77, 0xed, 0x96, 0xe8, 0xeb, + 0x88, 0x9c, 0xa9, 0x71, 0xe4, 0xbe, 0x68, 0x0f, 0x7b, 0x4c, 0xea, 0xa2, 0xab, 0x83, 0x80, 0xc9, + 0xdd, 0x82, 0xfe, 0xd1, 0x7e, 0xf8, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xca, 0xea, 0x72, + 0xf7, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -735,6 +1049,12 @@ type QueryClient interface { Denoms(ctx context.Context, in *QueryDenomsRequest, opts ...grpc.CallOption) (*QueryDenomsResponse, error) // NFT queries the NFT for the given denom and token ID NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc.CallOption) (*QueryNFTResponse, error) + // UserOf queries the user/renter of an NFT + UserOf(ctx context.Context, in *QueryUserOfRequest, opts ...grpc.CallOption) (*QueryUserOfResponse, error) + // UserOf queries the rental expiry of an NFT + UserExpires(ctx context.Context, in *QueryUserExpiresRequest, opts ...grpc.CallOption) (*QueryUserExpiresResponse, error) + // HasUser queries if an NFT has a user/renter + HasUser(ctx context.Context, in *QueryHasUserRequest, opts ...grpc.CallOption) (*QueryHasUserResponse, error) } type queryClient struct { @@ -799,6 +1119,33 @@ func (c *queryClient) NFT(ctx context.Context, in *QueryNFTRequest, opts ...grpc return out, nil } +func (c *queryClient) UserOf(ctx context.Context, in *QueryUserOfRequest, opts ...grpc.CallOption) (*QueryUserOfResponse, error) { + out := new(QueryUserOfResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/UserOf", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) UserExpires(ctx context.Context, in *QueryUserExpiresRequest, opts ...grpc.CallOption) (*QueryUserExpiresResponse, error) { + out := new(QueryUserExpiresResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/UserExpires", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) HasUser(ctx context.Context, in *QueryHasUserRequest, opts ...grpc.CallOption) (*QueryHasUserResponse, error) { + out := new(QueryHasUserResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Query/HasUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Supply queries the total supply of a given denom or owner @@ -813,6 +1160,12 @@ type QueryServer interface { Denoms(context.Context, *QueryDenomsRequest) (*QueryDenomsResponse, error) // NFT queries the NFT for the given denom and token ID NFT(context.Context, *QueryNFTRequest) (*QueryNFTResponse, error) + // UserOf queries the user/renter of an NFT + UserOf(context.Context, *QueryUserOfRequest) (*QueryUserOfResponse, error) + // UserOf queries the rental expiry of an NFT + UserExpires(context.Context, *QueryUserExpiresRequest) (*QueryUserExpiresResponse, error) + // HasUser queries if an NFT has a user/renter + HasUser(context.Context, *QueryHasUserRequest) (*QueryHasUserResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -837,6 +1190,15 @@ func (*UnimplementedQueryServer) Denoms(ctx context.Context, req *QueryDenomsReq func (*UnimplementedQueryServer) NFT(ctx context.Context, req *QueryNFTRequest) (*QueryNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NFT not implemented") } +func (*UnimplementedQueryServer) UserOf(ctx context.Context, req *QueryUserOfRequest) (*QueryUserOfResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserOf not implemented") +} +func (*UnimplementedQueryServer) UserExpires(ctx context.Context, req *QueryUserExpiresRequest) (*QueryUserExpiresResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UserExpires not implemented") +} +func (*UnimplementedQueryServer) HasUser(ctx context.Context, req *QueryHasUserRequest) (*QueryHasUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method HasUser not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -950,6 +1312,60 @@ func _Query_NFT_Handler(srv interface{}, ctx context.Context, dec func(interface return interceptor(ctx, in, info, handler) } +func _Query_UserOf_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUserOfRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UserOf(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/UserOf", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UserOf(ctx, req.(*QueryUserOfRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_UserExpires_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryUserExpiresRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).UserExpires(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/UserExpires", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).UserExpires(ctx, req.(*QueryUserExpiresRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_HasUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryHasUserRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).HasUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Query/HasUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).HasUser(ctx, req.(*QueryHasUserRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "irismod.nft.Query", HandlerType: (*QueryServer)(nil), @@ -978,6 +1394,18 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "NFT", Handler: _Query_NFT_Handler, }, + { + MethodName: "UserOf", + Handler: _Query_UserOf_Handler, + }, + { + MethodName: "UserExpires", + Handler: _Query_UserExpires_Handler, + }, + { + MethodName: "HasUser", + Handler: _Query_HasUser_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "nft/query.proto", @@ -1454,22 +1882,224 @@ func (m *QueryNFTResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { 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++ +func (m *QueryUserOfRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - dAtA[offset] = uint8(v) - return base + return dAtA[:n], nil } -func (m *QuerySupplyRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int + +func (m *QueryUserOfRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryUserOfResponse) 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 *QueryUserOfResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserOfResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryUserExpiresRequest) 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 *QueryUserExpiresRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserExpiresRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryUserExpiresResponse) 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 *QueryUserExpiresResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryUserExpiresResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Expires != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Expires)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryHasUserRequest) 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 *QueryHasUserRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHasUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryHasUserResponse) 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 *QueryHasUserResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryHasUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.HasUser { + i-- + if m.HasUser { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + 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 *QuerySupplyRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int _ = l l = len(m.DenomId) if l > 0 { @@ -1654,6 +2284,94 @@ func (m *QueryNFTResponse) Size() (n int) { return n } +func (m *QueryUserOfRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUserOfResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.User) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUserExpiresRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryUserExpiresResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Expires != 0 { + n += 1 + sovQuery(uint64(m.Expires)) + } + return n +} + +func (m *QueryHasUserRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryHasUserResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HasUser { + n += 2 + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2929,6 +3647,569 @@ func (m *QueryNFTResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryUserOfRequest) 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: QueryUserOfRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserOfRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + 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 *QueryUserOfResponse) 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: QueryUserOfResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserOfResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.User = string(dAtA[iNdEx:postIndex]) + 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 *QueryUserExpiresRequest) 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: QueryUserExpiresRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserExpiresRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + 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 *QueryUserExpiresResponse) 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: QueryUserExpiresResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryUserExpiresResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) + } + m.Expires = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Expires |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *QueryHasUserRequest) 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: QueryHasUserRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHasUserRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + 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 *QueryHasUserResponse) 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: QueryHasUserResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryHasUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field HasUser", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.HasUser = bool(v != 0) + 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 diff --git a/modules/nft/types/query.pb.gw.go b/modules/nft/types/query.pb.gw.go index 30ff7df3..29caf6c5 100644 --- a/modules/nft/types/query.pb.gw.go +++ b/modules/nft/types/query.pb.gw.go @@ -379,6 +379,234 @@ func local_request_Query_NFT_0(ctx context.Context, marshaler runtime.Marshaler, } +func request_Query_UserOf_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserOfRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := client.UserOf(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_UserOf_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserOfRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := server.UserOf(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_UserExpires_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserExpiresRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := client.UserExpires(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_UserExpires_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryUserExpiresRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := server.UserExpires(ctx, &protoReq) + return msg, metadata, err + +} + +func request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHasUserRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := client.HasUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryHasUserRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["class_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + } + + protoReq.ClassId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + } + + val, ok = pathParams["nft_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") + } + + protoReq.NftId, err = runtime.String(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) + } + + msg, err := server.HasUser(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. @@ -523,6 +751,75 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_UserOf_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_UserOf_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_UserOf_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UserExpires_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_UserExpires_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_UserExpires_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HasUser_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_HasUser_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_HasUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -684,6 +981,66 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_UserOf_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_UserOf_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_UserOf_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_UserExpires_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_UserExpires_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_UserExpires_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Query_HasUser_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_HasUser_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_HasUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -699,6 +1056,12 @@ var ( pattern_Query_Denoms_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"irismod", "nft", "denoms"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_NFT_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "nft", "nfts", "denom_id", "token_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_UserOf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "user", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_UserExpires_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "expires", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_HasUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "has_user", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -713,4 +1076,10 @@ var ( forward_Query_Denoms_0 = runtime.ForwardResponseMessage forward_Query_NFT_0 = runtime.ForwardResponseMessage + + forward_Query_UserOf_0 = runtime.ForwardResponseMessage + + forward_Query_UserExpires_0 = runtime.ForwardResponseMessage + + forward_Query_HasUser_0 = runtime.ForwardResponseMessage ) diff --git a/modules/rental/types/rental.pb.go b/modules/nft/types/rental.pb.go similarity index 85% rename from modules/rental/types/rental.pb.go rename to modules/nft/types/rental.pb.go index 0e47e7f5..3ee1e9dc 100644 --- a/modules/rental/types/rental.pb.go +++ b/modules/nft/types/rental.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rental/rental.proto +// source: nft/rental.proto package types @@ -35,7 +35,7 @@ func (m *RentalInfo) Reset() { *m = RentalInfo{} } func (m *RentalInfo) String() string { return proto.CompactTextString(m) } func (*RentalInfo) ProtoMessage() {} func (*RentalInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_a38471509ee7f89e, []int{0} + return fileDescriptor_e57beeaf512eaaa2, []int{0} } func (m *RentalInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -96,24 +96,24 @@ func init() { proto.RegisterType((*RentalInfo)(nil), "irismod.rental.RentalInfo") } -func init() { proto.RegisterFile("rental/rental.proto", fileDescriptor_a38471509ee7f89e) } +func init() { proto.RegisterFile("nft/rental.proto", fileDescriptor_e57beeaf512eaaa2) } -var fileDescriptor_a38471509ee7f89e = []byte{ - // 219 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x8f, 0xb1, 0x4e, 0x86, 0x30, - 0x14, 0x85, 0xa9, 0xe2, 0x8f, 0x76, 0x70, 0xa8, 0x9a, 0x54, 0x87, 0x86, 0x38, 0x31, 0xd1, 0xc1, - 0x37, 0x70, 0xeb, 0xca, 0xe8, 0x62, 0x80, 0x16, 0x6c, 0x52, 0x7a, 0x49, 0x5b, 0x12, 0x7d, 0x0b, - 0x1f, 0xcb, 0x91, 0xd1, 0xd1, 0xc0, 0x8b, 0x18, 0x0a, 0xff, 0x74, 0xcf, 0x39, 0xdf, 0x1d, 0xce, - 0xc1, 0x77, 0x4e, 0xd9, 0x50, 0x1b, 0xbe, 0x9f, 0x72, 0x74, 0x10, 0x80, 0xdc, 0x6a, 0xa7, 0xfd, - 0x00, 0xb2, 0xdc, 0xd3, 0xa7, 0xfb, 0x1e, 0x7a, 0x88, 0x88, 0x6f, 0x6a, 0xff, 0x7a, 0x36, 0x18, - 0x57, 0x91, 0x0b, 0xdb, 0x01, 0x21, 0x38, 0x9d, 0xbc, 0x72, 0x14, 0xe5, 0xa8, 0xb8, 0xa9, 0xa2, - 0x26, 0x8f, 0xf8, 0xba, 0x35, 0xb5, 0xf7, 0xef, 0x5a, 0xd2, 0x8b, 0x98, 0x67, 0xd1, 0x0b, 0x49, - 0x1e, 0xf0, 0xc9, 0x76, 0x61, 0x03, 0x97, 0x11, 0x5c, 0xd9, 0x2e, 0x08, 0x49, 0x28, 0xce, 0xd4, - 0xe7, 0xa8, 0x9d, 0xf2, 0x34, 0xcd, 0x51, 0x91, 0x56, 0x67, 0xfb, 0x2a, 0x7e, 0x16, 0x86, 0xe6, - 0x85, 0xa1, 0xbf, 0x85, 0xa1, 0xef, 0x95, 0x25, 0xf3, 0xca, 0x92, 0xdf, 0x95, 0x25, 0x6f, 0xbc, - 0xd7, 0xe1, 0x63, 0x6a, 0xca, 0x16, 0x06, 0xbe, 0x15, 0xb7, 0x2a, 0xf0, 0x63, 0x00, 0x1f, 0x40, - 0x4e, 0x46, 0xf9, 0x63, 0x1e, 0x0f, 0x5f, 0xa3, 0xf2, 0xcd, 0x29, 0xf6, 0x7f, 0xf9, 0x0f, 0x00, - 0x00, 0xff, 0xff, 0xa2, 0xbf, 0x96, 0xdb, 0xfc, 0x00, 0x00, 0x00, +var fileDescriptor_e57beeaf512eaaa2 = []byte{ + // 223 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x4b, 0x2b, 0xd1, + 0x2f, 0x4a, 0xcd, 0x2b, 0x49, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcb, 0x2c, + 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0x88, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xa5, + 0xf4, 0x41, 0x2c, 0x88, 0x2a, 0xa5, 0x1c, 0x2e, 0xae, 0x20, 0xb0, 0xbc, 0x67, 0x5e, 0x5a, 0xbe, + 0x90, 0x10, 0x17, 0x4b, 0x69, 0x71, 0x6a, 0x91, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x98, + 0x2d, 0x24, 0xc9, 0xc5, 0x91, 0x9c, 0x93, 0x58, 0x5c, 0x1c, 0x9f, 0x99, 0x22, 0xc1, 0x04, 0x16, + 0x67, 0x07, 0xf3, 0x3d, 0x53, 0x84, 0x44, 0xb9, 0xd8, 0xf2, 0xd2, 0x4a, 0x40, 0x12, 0xcc, 0x60, + 0x09, 0xd6, 0xbc, 0xb4, 0x12, 0xcf, 0x14, 0x21, 0x09, 0x2e, 0xf6, 0xd4, 0x8a, 0x82, 0xcc, 0xa2, + 0xd4, 0x62, 0x09, 0x16, 0x05, 0x46, 0x0d, 0x96, 0x20, 0x18, 0xd7, 0xc9, 0xed, 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, 0x74, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, + 0xf3, 0x73, 0xf5, 0x41, 0x0e, 0xcf, 0x4b, 0x2d, 0xd1, 0x87, 0x7a, 0x40, 0x3f, 0x37, 0x3f, 0xa5, + 0x34, 0x27, 0xb5, 0x58, 0x1f, 0xe4, 0xc5, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xe3, + 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x7c, 0xd6, 0xac, 0xf6, 0x00, 0x00, 0x00, } func (m *RentalInfo) Marshal() (dAtA []byte, err error) { diff --git a/modules/nft/types/tx.pb.go b/modules/nft/types/tx.pb.go index 01772340..ead3421b 100644 --- a/modules/nft/types/tx.pb.go +++ b/modules/nft/types/tx.pb.go @@ -6,16 +6,15 @@ package types import ( context "context" fmt "fmt" - io "io" - math "math" - math_bits "math/bits" - _ "github.com/gogo/protobuf/gogoproto" 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" + io "io" + math "math" + math_bits "math/bits" ) // Reference imports to suppress errors if they are not otherwise used. @@ -77,7 +76,7 @@ func (m *MsgIssueDenom) XXX_DiscardUnknown() { var xxx_messageInfo_MsgIssueDenom proto.InternalMessageInfo -// MsgIssueDenomResponse defines the Msg/SaveDenom response type. +// MsgIssueDenomResponse defines the Msg/IssueDenom response type. type MsgIssueDenomResponse struct { } @@ -240,7 +239,7 @@ func (m *MsgEditNFT) XXX_DiscardUnknown() { var xxx_messageInfo_MsgEditNFT proto.InternalMessageInfo -// MsgEditNFTResponse defines the Msg/UpdateNFT response type. +// MsgEditNFTResponse defines the Msg/EditNFT response type. type MsgEditNFTResponse struct { } @@ -322,7 +321,7 @@ func (m *MsgMintNFT) XXX_DiscardUnknown() { var xxx_messageInfo_MsgMintNFT proto.InternalMessageInfo -// MsgMintNFTResponse defines the Msg/SaveNFT response type. +// MsgMintNFTResponse defines the Msg/MintNFT response type. type MsgMintNFTResponse struct { } @@ -399,7 +398,7 @@ func (m *MsgBurnNFT) XXX_DiscardUnknown() { var xxx_messageInfo_MsgBurnNFT proto.InternalMessageInfo -// MsgBurnNFTResponse defines the Msg/RemoveNFT response type. +// MsgBurnNFTResponse defines the Msg/BurnNFT response type. type MsgBurnNFTResponse struct { } @@ -514,6 +513,85 @@ func (m *MsgTransferDenomResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgTransferDenomResponse proto.InternalMessageInfo +// MsgSetUser defines the Msg/SetUser response type. +type MsgSetUser struct { + ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` + User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"` + Expires uint64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` + Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` +} + +func (m *MsgSetUser) Reset() { *m = MsgSetUser{} } +func (m *MsgSetUser) String() string { return proto.CompactTextString(m) } +func (*MsgSetUser) ProtoMessage() {} +func (*MsgSetUser) Descriptor() ([]byte, []int) { + return fileDescriptor_09d30374d974e015, []int{12} +} +func (m *MsgSetUser) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetUser) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetUser.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 *MsgSetUser) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetUser.Merge(m, src) +} +func (m *MsgSetUser) XXX_Size() int { + return m.Size() +} +func (m *MsgSetUser) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetUser.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetUser proto.InternalMessageInfo + +// MsgSetUserResponse defines the Msg/SetUser response type. +type MsgSetUserResponse struct { +} + +func (m *MsgSetUserResponse) Reset() { *m = MsgSetUserResponse{} } +func (m *MsgSetUserResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSetUserResponse) ProtoMessage() {} +func (*MsgSetUserResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_09d30374d974e015, []int{13} +} +func (m *MsgSetUserResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSetUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSetUserResponse.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 *MsgSetUserResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSetUserResponse.Merge(m, src) +} +func (m *MsgSetUserResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSetUserResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSetUserResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSetUserResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgIssueDenom)(nil), "irismod.nft.MsgIssueDenom") proto.RegisterType((*MsgIssueDenomResponse)(nil), "irismod.nft.MsgIssueDenomResponse") @@ -527,53 +605,60 @@ func init() { proto.RegisterType((*MsgBurnNFTResponse)(nil), "irismod.nft.MsgBurnNFTResponse") proto.RegisterType((*MsgTransferDenom)(nil), "irismod.nft.MsgTransferDenom") proto.RegisterType((*MsgTransferDenomResponse)(nil), "irismod.nft.MsgTransferDenomResponse") + proto.RegisterType((*MsgSetUser)(nil), "irismod.nft.MsgSetUser") + proto.RegisterType((*MsgSetUserResponse)(nil), "irismod.nft.MsgSetUserResponse") } func init() { proto.RegisterFile("nft/tx.proto", fileDescriptor_09d30374d974e015) } var fileDescriptor_09d30374d974e015 = []byte{ - // 653 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x55, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0xe3, 0x36, 0x3f, 0x13, 0xfa, 0xc3, 0x52, 0xda, 0x6d, 0x00, 0xa7, 0x0a, 0x42, 0x54, - 0x02, 0x25, 0x12, 0xdc, 0x7a, 0x0c, 0x3f, 0xa2, 0x88, 0x80, 0x64, 0xb5, 0x17, 0x0e, 0x54, 0x6e, - 0x76, 0xeb, 0x2c, 0xaa, 0xd7, 0xd1, 0xee, 0x5a, 0xa2, 0x6f, 0xc1, 0x23, 0xf0, 0x1c, 0x3c, 0x41, - 0xc5, 0xa9, 0x47, 0x4e, 0x15, 0xa4, 0x12, 0x42, 0x1c, 0x79, 0x02, 0xe4, 0xb5, 0x9d, 0xac, 0x9d, - 0xa6, 0x27, 0x0e, 0x88, 0xdb, 0xee, 0xf7, 0x4d, 0x66, 0xe6, 0xfb, 0x66, 0x33, 0x86, 0x6b, 0xfc, - 0x48, 0x75, 0xd5, 0x87, 0xce, 0x48, 0x84, 0x2a, 0x44, 0x0d, 0x26, 0x98, 0x0c, 0x42, 0xd2, 0xe1, - 0x47, 0xaa, 0xb9, 0xe6, 0x87, 0x7e, 0xa8, 0xf1, 0x6e, 0x7c, 0x4a, 0x42, 0xda, 0x9f, 0xcb, 0xb0, - 0xd4, 0x97, 0xfe, 0xae, 0x94, 0x11, 0x7d, 0x4a, 0x79, 0x18, 0xa0, 0x65, 0x28, 0x33, 0x82, 0xad, - 0x2d, 0x6b, 0xbb, 0xee, 0x96, 0x19, 0x41, 0x08, 0x16, 0xb8, 0x17, 0x50, 0x5c, 0xd6, 0x88, 0x3e, - 0xa3, 0x75, 0xa8, 0xc8, 0xc1, 0x90, 0x06, 0x1e, 0xb6, 0x35, 0x9a, 0xde, 0x34, 0x4e, 0x39, 0xa1, - 0x02, 0x2f, 0xa4, 0xb8, 0xbe, 0x69, 0xfc, 0x24, 0x38, 0x0c, 0x8f, 0xf1, 0x62, 0x8a, 0xeb, 0x1b, - 0xba, 0x0f, 0x2b, 0x01, 0xe3, 0xea, 0x40, 0x50, 0xa9, 0x04, 0x1b, 0x28, 0x4a, 0x70, 0x65, 0xcb, - 0xda, 0xae, 0xb9, 0xcb, 0x31, 0xec, 0x4e, 0x50, 0xf4, 0x00, 0xae, 0x47, 0x23, 0xe2, 0x29, 0x6a, - 0x86, 0x56, 0x75, 0xe8, 0x6a, 0x42, 0x18, 0xc1, 0x5b, 0xd0, 0x20, 0x54, 0x0e, 0x04, 0x1b, 0x29, - 0x16, 0x72, 0x5c, 0xd3, 0x25, 0x4d, 0x08, 0xad, 0x82, 0x1d, 0x09, 0x86, 0xeb, 0x9a, 0x89, 0x8f, - 0x68, 0x13, 0x6a, 0x91, 0x60, 0x07, 0x43, 0x4f, 0x0e, 0x31, 0x68, 0xb8, 0x1a, 0x09, 0xf6, 0xc2, - 0x93, 0xc3, 0xd8, 0x00, 0xe2, 0x29, 0x0f, 0x37, 0x12, 0x03, 0xe2, 0xf3, 0xce, 0xc2, 0xcf, 0x4f, - 0x2d, 0xab, 0xbd, 0x01, 0x37, 0x73, 0xde, 0xb9, 0x54, 0x8e, 0x42, 0x2e, 0x69, 0xfb, 0x97, 0x05, - 0xcb, 0x7d, 0xe9, 0xef, 0x09, 0x8f, 0xcb, 0x23, 0x2a, 0x5e, 0x3f, 0xdf, 0x9b, 0xb1, 0xb5,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x34, 0xdb, 0xf3, 0xb9, 0x2c, 0x2b, 0x7a, 0x02, 0xd5, 0xec, - 0x39, 0x6d, 0x14, 0xc3, 0x53, 0xa2, 0xd9, 0x9a, 0x43, 0x98, 0x49, 0xb2, 0x3f, 0xdd, 0x4c, 0x92, - 0x94, 0x98, 0x4d, 0x52, 0x78, 0xdc, 0xe8, 0x0d, 0x34, 0xcc, 0x05, 0x76, 0xab, 0x18, 0x6f, 0x90, - 0xcd, 0xbb, 0x57, 0x90, 0x66, 0x57, 0xd9, 0x5b, 0x99, 0xe9, 0x2a, 0x25, 0x66, 0xbb, 0x2a, 0x4c, - 0x1c, 0xed, 0xc3, 0x52, 0x7e, 0xdc, 0x77, 0xe6, 0x95, 0x4e, 0x3c, 0xbf, 0x77, 0x25, 0x9d, 0xa5, - 0xed, 0xbd, 0x3c, 0xfd, 0xee, 0x94, 0x4e, 0xc7, 0x8e, 0x75, 0x36, 0x76, 0xac, 0x6f, 0x63, 0xc7, - 0xfa, 0x78, 0xe1, 0x94, 0xce, 0x2e, 0x9c, 0xd2, 0xd7, 0x0b, 0xa7, 0xf4, 0xf6, 0xa1, 0xcf, 0xd4, - 0x30, 0x3a, 0xec, 0x0c, 0xc2, 0xa0, 0x1b, 0xa7, 0xe3, 0x54, 0x75, 0xd3, 0xb4, 0xdd, 0x20, 0x24, - 0xd1, 0x31, 0x95, 0x5d, 0xfd, 0xe5, 0x3d, 0x19, 0x51, 0x79, 0x58, 0xd1, 0x9f, 0xd6, 0xc7, 0x7f, - 0x02, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x33, 0x0c, 0x0e, 0x8d, 0x07, 0x00, 0x00, + // 733 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0xf3, 0xe7, 0xe4, 0xe6, 0xeb, 0xcf, 0x37, 0xf4, 0xc7, 0x0d, 0x90, 0x54, 0x41, 0x88, + 0x4a, 0xa0, 0x44, 0x82, 0x5d, 0x97, 0x81, 0x22, 0x82, 0x08, 0x48, 0xa6, 0xdd, 0xb0, 0x20, 0x72, + 0xe3, 0x49, 0x32, 0x28, 0x1e, 0x47, 0x33, 0x63, 0xa9, 0xdd, 0xf3, 0x00, 0xf0, 0x06, 0x3c, 0x07, + 0x4f, 0xd0, 0x65, 0x97, 0xac, 0x2a, 0x48, 0x25, 0x84, 0x58, 0xf2, 0x04, 0x28, 0xe3, 0xb1, 0x33, + 0x8e, 0x9b, 0xae, 0x58, 0x20, 0x76, 0x33, 0xe7, 0x4c, 0xef, 0x9c, 0x73, 0xee, 0xed, 0xc4, 0xf0, + 0x1f, 0x1d, 0x88, 0x96, 0x38, 0x69, 0x4e, 0x98, 0x2f, 0x7c, 0x54, 0x21, 0x8c, 0x70, 0xcf, 0x77, + 0x9b, 0x74, 0x20, 0xaa, 0x1b, 0x43, 0x7f, 0xe8, 0x4b, 0xbc, 0x35, 0x5b, 0x85, 0x47, 0x1a, 0x9f, + 0xb3, 0xb0, 0xd2, 0xe5, 0xc3, 0x0e, 0xe7, 0x01, 0x7e, 0x82, 0xa9, 0xef, 0xa1, 0x55, 0xc8, 0x12, + 0xd7, 0x32, 0x76, 0x8d, 0xbd, 0xb2, 0x9d, 0x25, 0x2e, 0x42, 0x90, 0xa7, 0x8e, 0x87, 0xad, 0xac, + 0x44, 0xe4, 0x1a, 0x6d, 0x41, 0x91, 0xf7, 0x47, 0xd8, 0x73, 0xac, 0x9c, 0x44, 0xd5, 0x4e, 0xe2, + 0x98, 0xba, 0x98, 0x59, 0x79, 0x85, 0xcb, 0x9d, 0xc4, 0x4f, 0xbd, 0x63, 0x7f, 0x6c, 0x15, 0x14, + 0x2e, 0x77, 0xe8, 0x1e, 0xac, 0x79, 0x84, 0x8a, 0x1e, 0xc3, 0x5c, 0x30, 0xd2, 0x17, 0xd8, 0xb5, + 0x8a, 0xbb, 0xc6,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 0x66, 0x7d, 0x7b, 0xf1, 0xb8, 0x22, 0xaa, 0xf5, 0x25, 0x84, 0x5e, 0x24, 0x7a, 0x11, 0x52, 0x45, + 0x14, 0x91, 0x2e, 0xb2, 0xf0, 0x9f, 0x87, 0x5e, 0x41, 0x45, 0x7f, 0x5d, 0x6f, 0x2e, 0x9e, 0xd7, + 0xc8, 0xea, 0x9d, 0x6b, 0x48, 0x5d, 0x55, 0x34, 0xc8, 0x29, 0x55, 0x8a, 0x48, 0xab, 0x5a, 0x18, + 0x47, 0x74, 0x04, 0x2b, 0xc9, 0x59, 0xbc, 0xbd, 0xec, 0xea, 0x30, 0xf3, 0xbb, 0xd7, 0xd2, 0x71, + 0xd9, 0x03, 0x30, 0xa3, 0x29, 0x4b, 0x69, 0x53, 0x44, 0x5a, 0xdb, 0xc2, 0x44, 0x34, 0x32, 0xed, + 0xe7, 0x67, 0xdf, 0x6a, 0x99, 0xb3, 0x69, 0xcd, 0x38, 0x9f, 0xd6, 0x8c, 0xaf, 0xd3, 0x9a, 0xf1, + 0xe1, 0xb2, 0x96, 0x39, 0xbf, 0xac, 0x65, 0xbe, 0x5c, 0xd6, 0x32, 0x6f, 0x1e, 0x0c, 0x89, 0x18, + 0x05, 0xc7, 0xcd, 0xbe, 0xef, 0xb5, 0x66, 0xa5, 0x28, 0x16, 0x2d, 0x55, 0xb2, 0xe5, 0xf9, 0x6e, + 0x30, 0xc6, 0xbc, 0x25, 0xbf, 0x2e, 0x4e, 0x27, 0x98, 0x1f, 0x17, 0xe5, 0xe7, 0xc3, 0xa3, 0xdf, + 0x01, 0x00, 0x00, 0xff, 0xff, 0xe5, 0xf2, 0xca, 0x83, 0x71, 0x08, 0x00, 0x00, } func (this *MsgIssueDenom) Equal(that interface{}) bool { @@ -847,6 +932,8 @@ type MsgClient interface { BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.CallOption) (*MsgBurnNFTResponse, error) // TransferDenom defines a method for transferring a denom. TransferDenom(ctx context.Context, in *MsgTransferDenom, opts ...grpc.CallOption) (*MsgTransferDenomResponse, error) + // SetUser defines a method for set user for an NFT. + SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.CallOption) (*MsgSetUserResponse, error) } type msgClient struct { @@ -859,7 +946,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) IssueDenom(ctx context.Context, in *MsgIssueDenom, opts ...grpc.CallOption) (*MsgIssueDenomResponse, error) { out := new(MsgIssueDenomResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Msg/SaveDenom", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/IssueDenom", in, out, opts...) if err != nil { return nil, err } @@ -868,7 +955,7 @@ func (c *msgClient) IssueDenom(ctx context.Context, in *MsgIssueDenom, opts ...g func (c *msgClient) MintNFT(ctx context.Context, in *MsgMintNFT, opts ...grpc.CallOption) (*MsgMintNFTResponse, error) { out := new(MsgMintNFTResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Msg/SaveNFT", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/MintNFT", in, out, opts...) if err != nil { return nil, err } @@ -877,7 +964,7 @@ func (c *msgClient) MintNFT(ctx context.Context, in *MsgMintNFT, opts ...grpc.Ca func (c *msgClient) EditNFT(ctx context.Context, in *MsgEditNFT, opts ...grpc.CallOption) (*MsgEditNFTResponse, error) { out := new(MsgEditNFTResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Msg/UpdateNFT", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/EditNFT", in, out, opts...) if err != nil { return nil, err } @@ -895,7 +982,7 @@ func (c *msgClient) TransferNFT(ctx context.Context, in *MsgTransferNFT, opts .. func (c *msgClient) BurnNFT(ctx context.Context, in *MsgBurnNFT, opts ...grpc.CallOption) (*MsgBurnNFTResponse, error) { out := new(MsgBurnNFTResponse) - err := c.cc.Invoke(ctx, "/irismod.nft.Msg/RemoveNFT", in, out, opts...) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/BurnNFT", in, out, opts...) if err != nil { return nil, err } @@ -911,6 +998,15 @@ func (c *msgClient) TransferDenom(ctx context.Context, in *MsgTransferDenom, opt return out, nil } +func (c *msgClient) SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.CallOption) (*MsgSetUserResponse, error) { + out := new(MsgSetUserResponse) + err := c.cc.Invoke(ctx, "/irismod.nft.Msg/SetUser", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // IssueDenom defines a method for issue a denom. @@ -925,6 +1021,8 @@ type MsgServer interface { BurnNFT(context.Context, *MsgBurnNFT) (*MsgBurnNFTResponse, error) // TransferDenom defines a method for transferring a denom. TransferDenom(context.Context, *MsgTransferDenom) (*MsgTransferDenomResponse, error) + // SetUser defines a method for set user for an NFT. + SetUser(context.Context, *MsgSetUser) (*MsgSetUserResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -932,23 +1030,26 @@ type UnimplementedMsgServer struct { } func (*UnimplementedMsgServer) IssueDenom(ctx context.Context, req *MsgIssueDenom) (*MsgIssueDenomResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SaveDenom not implemented") + return nil, status.Errorf(codes.Unimplemented, "method IssueDenom not implemented") } func (*UnimplementedMsgServer) MintNFT(ctx context.Context, req *MsgMintNFT) (*MsgMintNFTResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SaveNFT not implemented") + return nil, status.Errorf(codes.Unimplemented, "method MintNFT not implemented") } func (*UnimplementedMsgServer) EditNFT(ctx context.Context, req *MsgEditNFT) (*MsgEditNFTResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateNFT not implemented") + return nil, status.Errorf(codes.Unimplemented, "method EditNFT not implemented") } func (*UnimplementedMsgServer) TransferNFT(ctx context.Context, req *MsgTransferNFT) (*MsgTransferNFTResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferNFT not implemented") } func (*UnimplementedMsgServer) BurnNFT(ctx context.Context, req *MsgBurnNFT) (*MsgBurnNFTResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveNFT not implemented") + return nil, status.Errorf(codes.Unimplemented, "method BurnNFT not implemented") } func (*UnimplementedMsgServer) TransferDenom(ctx context.Context, req *MsgTransferDenom) (*MsgTransferDenomResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method TransferDenom not implemented") } +func (*UnimplementedMsgServer) SetUser(ctx context.Context, req *MsgSetUser) (*MsgSetUserResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetUser not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -964,7 +1065,7 @@ func _Msg_IssueDenom_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.nft.Msg/SaveDenom", + FullMethod: "/irismod.nft.Msg/IssueDenom", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).IssueDenom(ctx, req.(*MsgIssueDenom)) @@ -982,7 +1083,7 @@ func _Msg_MintNFT_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.nft.Msg/SaveNFT", + FullMethod: "/irismod.nft.Msg/MintNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).MintNFT(ctx, req.(*MsgMintNFT)) @@ -1000,7 +1101,7 @@ func _Msg_EditNFT_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.nft.Msg/UpdateNFT", + FullMethod: "/irismod.nft.Msg/EditNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).EditNFT(ctx, req.(*MsgEditNFT)) @@ -1036,7 +1137,7 @@ func _Msg_BurnNFT_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/irismod.nft.Msg/RemoveNFT", + FullMethod: "/irismod.nft.Msg/BurnNFT", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).BurnNFT(ctx, req.(*MsgBurnNFT)) @@ -1062,20 +1163,38 @@ func _Msg_TransferDenom_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Msg_SetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSetUser) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SetUser(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/irismod.nft.Msg/SetUser", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SetUser(ctx, req.(*MsgSetUser)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "irismod.nft.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "SaveDenom", + MethodName: "IssueDenom", Handler: _Msg_IssueDenom_Handler, }, { - MethodName: "SaveNFT", + MethodName: "MintNFT", Handler: _Msg_MintNFT_Handler, }, { - MethodName: "UpdateNFT", + MethodName: "EditNFT", Handler: _Msg_EditNFT_Handler, }, { @@ -1083,13 +1202,17 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_TransferNFT_Handler, }, { - MethodName: "RemoveNFT", + MethodName: "BurnNFT", Handler: _Msg_BurnNFT_Handler, }, { MethodName: "TransferDenom", Handler: _Msg_TransferDenom_Handler, }, + { + MethodName: "SetUser", + Handler: _Msg_SetUser_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "nft/tx.proto", @@ -1657,6 +1780,85 @@ func (m *MsgTransferDenomResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *MsgSetUser) 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 *MsgSetUser) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetUser) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x2a + } + if m.Expires != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Expires)) + i-- + dAtA[i] = 0x20 + } + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintTx(dAtA, i, uint64(len(m.User))) + i-- + dAtA[i] = 0x1a + } + if len(m.NftId) > 0 { + i -= len(m.NftId) + copy(dAtA[i:], m.NftId) + i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) + i-- + dAtA[i] = 0x12 + } + if len(m.ClassId) > 0 { + i -= len(m.ClassId) + copy(dAtA[i:], m.ClassId) + i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSetUserResponse) 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 *MsgSetUserResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSetUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -1934,6 +2136,43 @@ func (m *MsgTransferDenomResponse) Size() (n int) { return n } +func (m *MsgSetUser) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ClassId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.NftId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.User) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Expires != 0 { + n += 1 + sovTx(uint64(m.Expires)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSetUserResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -3796,6 +4035,253 @@ func (m *MsgTransferDenomResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgSetUser) 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 ErrIntOverflowTx + } + 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: MsgSetUser: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetUser: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ClassId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NftId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) + } + m.Expires = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Expires |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSetUserResponse) 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 ErrIntOverflowTx + } + 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: MsgSetUserResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSetUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/modules/rental/client/cli/query.go b/modules/rental/client/cli/query.go deleted file mode 100644 index ed61050b..00000000 --- a/modules/rental/client/cli/query.go +++ /dev/null @@ -1,8 +0,0 @@ -package cli - -import "github.com/spf13/cobra" - -func GetQueryCmd() *cobra.Command { - // fixme - panic("Fixme!") -} diff --git a/modules/rental/client/cli/tx.go b/modules/rental/client/cli/tx.go deleted file mode 100644 index 38d908fe..00000000 --- a/modules/rental/client/cli/tx.go +++ /dev/null @@ -1,8 +0,0 @@ -package cli - -import "github.com/spf13/cobra" - -func GetTxCmd() *cobra.Command { - // fixme - panic("Fixme!") -} diff --git a/modules/rental/keeper/genesis.go b/modules/rental/keeper/genesis.go deleted file mode 100644 index 11f7f808..00000000 --- a/modules/rental/keeper/genesis.go +++ /dev/null @@ -1,28 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/irisnet/irismod/modules/rental/types" -) - -// InitGenesis stores the NFT genesis. -func (k Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) { - if err := types.ValidateGenesis(gs); err != nil { - panic(err.Error()) - } - - for _, v := range gs.RenterInfos { - user, err := sdk.AccAddressFromBech32(v.User) - if err != nil { - panic(err) - } - k.SetRentalInfo(ctx, v.ClassId, v.NftId, user, v.Expires) - } -} - -// ExportGenesis returns a GenesisState for a given context and keeper. -func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - ris := k.GetRentalInfos(ctx) - return types.NewGenesisState(ris) -} diff --git a/modules/rental/keeper/keeper.go b/modules/rental/keeper/keeper.go deleted file mode 100644 index 21d2c879..00000000 --- a/modules/rental/keeper/keeper.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper - -import ( - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - nftkeeper "github.com/cosmos/cosmos-sdk/x/nft/keeper" -) - -type Keeper struct { - storeKey storetypes.StoreKey - cdc codec.Codec - nk nftkeeper.Keeper -} - -// NewKeeper creates a new instance of rental keeper -func NewKeeper(cdc codec.Codec, storeKey storetypes.StoreKey, nk nftkeeper.Keeper) Keeper { - return Keeper{ - storeKey: storeKey, - cdc: cdc, - nk: nk, - } -} diff --git a/modules/rental/keeper/keeper_test.go b/modules/rental/keeper/keeper_test.go deleted file mode 100644 index 464a8b84..00000000 --- a/modules/rental/keeper/keeper_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package keeper_test - -import ( - "github.com/cosmos/cosmos-sdk/x/nft" - "testing" - - "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/irisnet/irismod/simapp" - "github.com/stretchr/testify/suite" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtime "github.com/tendermint/tendermint/types/time" - - rental "github.com/irisnet/irismod/modules/rental/types" -) - -const ( - testClassID = "flower" - testClassName = "Crypto Flower" - testClassSymbol = "flower" - testClassDescription = "Crypto Flower" - testClassURI = "class uri" - testClassURIHash = "ae702cefd6b6a65fe2f991ad6d9969ed" - testID = "iris" - testURI = "iris uri" - testURIHash = "229bfd3c1b431c14a526497873897108" - - testAccNumber = 2 - testOwnerIdx = 0 - testUserIdx = 1 - - testExpires = "999999999999999" -) - -type TestSuite struct { - suite.Suite - - app *simapp.SimApp - ctx sdk.Context - addrs []sdk.AccAddress - - queryClient rental.QueryClient -} - -func (s *TestSuite) SetupTest() { - app := simapp.Setup(s.T(), false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - ctx = ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) - - queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) - rental.RegisterQueryServer(queryHelper, app.RentalKeeper) - queryClient := rental.NewQueryClient(queryHelper) - - s.app = app - s.ctx = ctx - s.queryClient = queryClient - s.addrs = simapp.AddTestAddrsIncremental(app, ctx, testAccNumber, sdk.NewInt(30000000)) - - s.prepareNFT() -} - -func TestTestSuite(t *testing.T) { - suite.Run(t, new(TestSuite)) -} - -func (s *TestSuite) TestRent() { - // s.app.RentalKeeper.Rent() -} - -// prepareNFT setups nft for rental testing -func (s *TestSuite) prepareNFT() { - testClass := nft.Class{ - Id: testClassID, - Name: testClassName, - Symbol: testClassSymbol, - Description: testClassDescription, - Uri: testClassURI, - UriHash: testClassURIHash, - } - - err := s.app.NFTKeeper.NFTkeeper().SaveClass(s.ctx, testClass) - s.Require().NoError(err) - - testNft := nft.NFT{ - ClassId: testClassID, - Id: testID, - Uri: testURI, - UriHash: testURIHash, - } - - err = s.app.NFTKeeper.NFTkeeper().Mint(s.ctx, testNft, s.addrs[testOwnerIdx]) - s.Require().NoError(err) -} diff --git a/modules/rental/module/module.go b/modules/rental/module/module.go deleted file mode 100644 index a6e952aa..00000000 --- a/modules/rental/module/module.go +++ /dev/null @@ -1,176 +0,0 @@ -package module - -import ( - "context" - "encoding/json" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/cosmos/cosmos-sdk/x/nft" - "github.com/irisnet/irismod/modules/rental/client/cli" - "github.com/irisnet/irismod/modules/rental/simulation" - "math/rand" - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - - "github.com/irisnet/irismod/modules/rental/keeper" - "github.com/irisnet/irismod/modules/rental/types" -) - -var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} - _ module.AppModuleSimulation = AppModule{} -) - -// AppModuleBasic defines the basic application module used by the rental module. -type AppModuleBasic struct { - cdc codec.Codec -} - -// Name returns the Rental module's name. -func (AppModuleBasic) Name() string { return types.ModuleName } - -// RegisterLegacyAminoCodec registers the rental module's types on the LegacyAmino codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} - -// DefaultGenesis returns default genesis state as raw bytes for the rental module. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - return cdc.MustMarshalJSON(types.DefaultGenesisState()) -} - -// ValidateGenesis performs genesis state validation for the rental module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { - var genesisState types.GenesisState - if err := cdc.UnmarshalJSON(bz, &genesisState); err != nil { - return sdkerrors.Wrapf(err, "failed to unmarshal %s genesis state", nft.ModuleName) - } - - return types.ValidateGenesis(genesisState) -} - -// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the rental module. -func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) { - if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil { - panic(err) - } -} - -// GetTxCmd returns the root tx command for the rental module. -func (AppModuleBasic) GetTxCmd() *cobra.Command { - return cli.GetTxCmd() -} - -// GetQueryCmd returns the root query command for the rental module. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd() -} - -// RegisterInterfaces registers interfaces and implementations of the rental module. -func (AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - types.RegisterInterfaces(registry) -} - -// AppModule implements an application module for the rental module -type AppModule struct { - AppModuleBasic - - keeper keeper.Keeper - registry cdctypes.InterfaceRegistry -} - -// NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { - return AppModule{ - AppModuleBasic: AppModuleBasic{cdc: cdc}, - keeper: keeper, - } -} - -// Name returns the rental module's name. -func (AppModule) Name() string { return types.ModuleName } - -// RegisterInvariants registers the rental module invariants. -// NOTE: there's no invariants to enforce -func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) { -} - -// Deprecated: Route returns the message routing key for the rental module. -func (AppModule) Route() sdk.Route { - return sdk.Route{} -} - -// QuerierRoute returns the rental module's querier route name. -func (AppModule) QuerierRoute() string { - return "" -} - -// LegacyQuerierHandler returns the rental module sdk.Querier. -func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { - return nil -} - -// RegisterServices registers module gRPC services. -func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), am.keeper) - types.RegisterQueryServer(cfg.QueryServer(), am.keeper) -} - -// InitGenesis performs genesis initialization for the rental module. It returns -// no validator updates. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) []abci.ValidatorUpdate { - var genesisState types.GenesisState - cdc.MustUnmarshalJSON(bz, &genesisState) - am.keeper.InitGenesis(ctx, &genesisState) - - return []abci.ValidatorUpdate{} -} - -// ExportGenesis returns the exported genesis state as raw bytes for the rental module. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.keeper.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// AppModuleSimulation function - -// GenerateGenesisState creates a randomized GenState of the rental module. -func (AppModule) GenerateGenesisState(simState *module.SimulationState) { - simulation.RandomizedGenState(simState) -} - -// ProposalContents is used to simulate governance proposals -func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { - return nil -} - -// RandomizedParams generates randomized module parameters for param change proposals -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return nil -} - -// RegisterStoreDecoder registers a func to decode the each module's defined types from their corresponding store key -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { - sdr[keeper.StoreKey] = simulation.NewDecodeStore(am.cdc) -} - -// WeightedOperations sets simulation operations with their respective weight -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { - return simulation.WeightedOperations( - am.registry, - simState.AppParams, simState.Cdc, - am.keeper, - ) -} diff --git a/modules/rental/simulation/decoder.go b/modules/rental/simulation/decoder.go deleted file mode 100644 index 2472ac5a..00000000 --- a/modules/rental/simulation/decoder.go +++ /dev/null @@ -1,12 +0,0 @@ -package simulation - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/types/kv" -) - -// NewDecodeStore returns a decoder function closure that unmarshals the KVPair's -// Value to the corresponding rental type. -func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { - panic("Fixme!") -} diff --git a/modules/rental/simulation/genesis.go b/modules/rental/simulation/genesis.go deleted file mode 100644 index 3abe4921..00000000 --- a/modules/rental/simulation/genesis.go +++ /dev/null @@ -1,8 +0,0 @@ -package simulation - -import "github.com/cosmos/cosmos-sdk/types/module" - -func RandomizedGenState(simState *module.SimulationState) { - // fixme - panic("Fixme!") -} diff --git a/modules/rental/simulation/operations.go b/modules/rental/simulation/operations.go deleted file mode 100644 index 2d10604b..00000000 --- a/modules/rental/simulation/operations.go +++ /dev/null @@ -1,20 +0,0 @@ -package simulation - -import ( - "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - "github.com/cosmos/cosmos-sdk/x/simulation" - - "github.com/irisnet/irismod/modules/rental/keeper" -) - -// WeightedOperations returns all the operations from the module with their respective weights -func WeightedOperations( - registry cdctypes.InterfaceRegistry, - appParams simtypes.AppParams, - cdc codec.JSONCodec, - k keeper.Keeper, -) simulation.WeightedOperations { - panic("Fixme") -} diff --git a/modules/rental/types/codec.go b/modules/rental/types/codec.go deleted file mode 100644 index 4bbb2bcb..00000000 --- a/modules/rental/types/codec.go +++ /dev/null @@ -1,33 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "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 = codec.NewAminoCodec(amino) -) - -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgSetUser{}, "irismod/rental/MsgSetUser", nil) -} - -func RegisterInterfaces(registry types.InterfaceRegistry) { - registry.RegisterImplementations( - (*sdk.Msg)(nil), - &MsgSetUser{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) - amino.Seal() -} diff --git a/modules/rental/types/errors.go b/modules/rental/types/errors.go deleted file mode 100644 index 49fb6017..00000000 --- a/modules/rental/types/errors.go +++ /dev/null @@ -1,13 +0,0 @@ -package types - -import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - -var ( - ErrInvalidNftID = sdkerrors.Register(ModuleName, 1, "invalid nft id") - ErrInvalidClassID = sdkerrors.Register(ModuleName, 2, "invalid class id") - ErrInvalidExpires = sdkerrors.Register(ModuleName, 3, "invalid expires") - ErrNotApprovedNorOwner = sdkerrors.Register(ModuleName, 4, "sender is not owner nor approved") - ErrNotArriveExpires = sdkerrors.Register(ModuleName, 5, "rental has not expires") - ErrNotExistentNFT = sdkerrors.Register(ModuleName, 6, "nft is not existent") - ErrNotExistentRentalInfo = sdkerrors.Register(ModuleName, 7, "rental info is not existent") -) diff --git a/modules/rental/types/events.go b/modules/rental/types/events.go deleted file mode 100644 index 4d7f4418..00000000 --- a/modules/rental/types/events.go +++ /dev/null @@ -1,14 +0,0 @@ -package types - -// rental module event types -var ( - EventTypeSetUser = "set_user" - - AttributeValueCategory = ModuleName - - AttributeKeySender = "sender" - AttributeKeyUser = "user" - AttributeKeyClassId = "class_id" - AttributeKeyNftId = "nft_id" - AttributeKeyExpires = "expires" -) diff --git a/modules/rental/types/expected_keepers.go b/modules/rental/types/expected_keepers.go deleted file mode 100644 index ab1254f4..00000000 --- a/modules/rental/types/expected_keepers.go +++ /dev/null @@ -1 +0,0 @@ -package types diff --git a/modules/rental/types/genesis.go b/modules/rental/types/genesis.go deleted file mode 100644 index 93e9b1cc..00000000 --- a/modules/rental/types/genesis.go +++ /dev/null @@ -1,54 +0,0 @@ -package types - -import ( - "encoding/json" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" - - "github.com/cosmos/cosmos-sdk/codec" -) - -// NewGenesisState creates a new genesis state. -func NewGenesisState(renterInfos []RentalInfo) *GenesisState { - return &GenesisState{ - RenterInfos: renterInfos, - } -} - -// DefaultGenesisState returns a default rental module genesis state. -func DefaultGenesisState() *GenesisState { - return NewGenesisState([]RentalInfo{}) -} - -// GetGenesisStateFromAppState returns rental GenesisState given raw application genesis state. -func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState { - var genesisState GenesisState - - if appState[ModuleName] != nil { - cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) - } - - return &genesisState -} - -// ValidateGenesis check the given genesis state has no integrity issues -func ValidateGenesis(gs GenesisState) error { - for _, v := range gs.RenterInfos { - if err := nfttypes.ValidateClassID(v.ClassId); err != nil { - return sdkerrors.Wrapf(ErrInvalidClassID, "Invalid class id (%s)", v.ClassId) - } - - if err := nfttypes.ValidateNFTID(v.NftId); err != nil { - return sdkerrors.Wrapf(ErrInvalidNftID, "Invalid nft id (%s)", v.NftId) - - } - - _, err := sdk.AccAddressFromBech32(v.User) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid user address (%s)", v.User) - } - } - - return nil -} diff --git a/modules/rental/types/genesis.pb.go b/modules/rental/types/genesis.pb.go deleted file mode 100644 index 1bb125b6..00000000 --- a/modules/rental/types/genesis.pb.go +++ /dev/null @@ -1,330 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rental/genesis.proto - -package types - -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 rental module's genesis state -type GenesisState struct { - RenterInfos []RentalInfo `protobuf:"bytes,1,rep,name=renterInfos,proto3" json:"renterInfos"` -} - -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_2f80438895461b63, []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) GetRenterInfos() []RentalInfo { - if m != nil { - return m.RenterInfos - } - return nil -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "irismod.rental.GenesisState") -} - -func init() { proto.RegisterFile("rental/genesis.proto", fileDescriptor_2f80438895461b63) } - -var fileDescriptor_2f80438895461b63 = []byte{ - // 200 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x4a, 0xcd, 0x2b, - 0x49, 0xcc, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, - 0x17, 0xe2, 0xcb, 0x2c, 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0xc8, 0x4a, 0x89, 0xa4, 0xe7, - 0xa7, 0xe7, 0x83, 0xa5, 0xf4, 0x41, 0x2c, 0x88, 0x2a, 0x29, 0x61, 0xa8, 0x5e, 0x08, 0x05, 0x11, - 0x54, 0x0a, 0xe2, 0xe2, 0x71, 0x87, 0x98, 0x15, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0xe4, 0xc4, 0xc5, - 0x0d, 0x92, 0x4f, 0x2d, 0xf2, 0xcc, 0x4b, 0xcb, 0x2f, 0x96, 0x60, 0x54, 0x60, 0xd6, 0xe0, 0x36, - 0x92, 0xd2, 0x43, 0xb5, 0x40, 0x2f, 0x08, 0x4c, 0x81, 0x94, 0x38, 0xb1, 0x9c, 0xb8, 0x27, 0xcf, - 0x10, 0x84, 0xac, 0xc9, 0xc9, 0xf3, 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, - 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x46, 0xe6, 0xa5, - 0x96, 0xe8, 0x43, 0x8d, 0xd6, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x2d, 0x86, 0x3a, 0x4f, 0xbf, - 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x4a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x68, 0x5f, 0x5f, 0x65, 0xf8, 0x00, 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.RenterInfos) > 0 { - for iNdEx := len(m.RenterInfos) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.RenterInfos[iNdEx].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 - if len(m.RenterInfos) > 0 { - for _, e := range m.RenterInfos { - 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 RenterInfos", 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.RenterInfos = append(m.RenterInfos, RentalInfo{}) - if err := m.RenterInfos[len(m.RenterInfos)-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/modules/rental/types/key.go b/modules/rental/types/key.go deleted file mode 100644 index f3f95d1c..00000000 --- a/modules/rental/types/key.go +++ /dev/null @@ -1,15 +0,0 @@ -package types - -const ( - // ModuleName defines the module name - ModuleName = "rental" - - // StoreKey defines the primary module store key - StoreKey = ModuleName - - // RouterKey defines the module's message routing key - RouterKey = ModuleName - - // QuerierRoute defines the module's query routing key - QuerierRoute = ModuleName -) diff --git a/modules/rental/types/msgs.go b/modules/rental/types/msgs.go deleted file mode 100644 index 785e0427..00000000 --- a/modules/rental/types/msgs.go +++ /dev/null @@ -1,72 +0,0 @@ -package types - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - nfttypes "github.com/cosmos/cosmos-sdk/x/nft" -) - -const ( - TypeMsgSetUser = "set_user" -) - -var ( - _ sdk.Msg = &MsgSetUser{} -) - -func NewMsgSetUser(classId, nftId, user string, - expires uint64, sender string) *MsgSetUser { - return &MsgSetUser{ - ClassId: classId, - NftId: nftId, - User: user, - Expires: expires, - Sender: sender, - } -} - -// Route Implements LegacyMsg -func (m MsgSetUser) Route() string { return RouterKey } - -// Type Implements LegacyMsg -func (m MsgSetUser) Type() string { return TypeMsgSetUser } - -// GetSignBytes Implements LegacyMsg -func (m MsgSetUser) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(&m) - return sdk.MustSortJSON(bz) -} - -// ValidateBasic implements the Msg.ValidateBasic method. -func (m MsgSetUser) ValidateBasic() error { - if err := nfttypes.ValidateClassID(m.ClassId); err != nil { - return sdkerrors.Wrapf(ErrInvalidClassID, "Invalid class id (%s)", m.ClassId) - } - - if err := nfttypes.ValidateNFTID(m.NftId); err != nil { - return sdkerrors.Wrapf(ErrInvalidNftID, "Invalid nft id (%s)", m.NftId) - } - - _, err := sdk.AccAddressFromBech32(m.Sender) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", m.Sender) - } - - _, err = sdk.AccAddressFromBech32(m.User) - if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid user address (%s)", m.User) - - } - - if m.Expires == 0 { - return sdkerrors.Wrapf(ErrInvalidExpires, "Invalid expires (%d)", m.Expires) - } - - return nil -} - -// GetSigners implements the Msg.GetSigners method. -func (m MsgSetUser) GetSigners() []sdk.AccAddress { - signer, _ := sdk.AccAddressFromBech32(m.Sender) - return []sdk.AccAddress{signer} -} diff --git a/modules/rental/types/query.pb.go b/modules/rental/types/query.pb.go deleted file mode 100644 index 72677b06..00000000 --- a/modules/rental/types/query.pb.go +++ /dev/null @@ -1,1413 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rental/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "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 - -// QueryUserRequest is the request type for the Query/Renter RPC method -type QueryUserRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *QueryUserRequest) Reset() { *m = QueryUserRequest{} } -func (m *QueryUserRequest) String() string { return proto.CompactTextString(m) } -func (*QueryUserRequest) ProtoMessage() {} -func (*QueryUserRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_716e6efac23cde5d, []int{0} -} -func (m *QueryUserRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryUserRequest.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 *QueryUserRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUserRequest.Merge(m, src) -} -func (m *QueryUserRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryUserRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUserRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryUserRequest proto.InternalMessageInfo - -// QueryUserResponse is the response type for the Query/Renter RPC method -type QueryUserResponse struct { - User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` -} - -func (m *QueryUserResponse) Reset() { *m = QueryUserResponse{} } -func (m *QueryUserResponse) String() string { return proto.CompactTextString(m) } -func (*QueryUserResponse) ProtoMessage() {} -func (*QueryUserResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_716e6efac23cde5d, []int{1} -} -func (m *QueryUserResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryUserResponse.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 *QueryUserResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryUserResponse.Merge(m, src) -} -func (m *QueryUserResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryUserResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryUserResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryUserResponse proto.InternalMessageInfo - -// QueryExpiresRequest is the request type for the Query/Expires RPC method -type QueryExpiresRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *QueryExpiresRequest) Reset() { *m = QueryExpiresRequest{} } -func (m *QueryExpiresRequest) String() string { return proto.CompactTextString(m) } -func (*QueryExpiresRequest) ProtoMessage() {} -func (*QueryExpiresRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_716e6efac23cde5d, []int{2} -} -func (m *QueryExpiresRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryExpiresRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryExpiresRequest.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 *QueryExpiresRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryExpiresRequest.Merge(m, src) -} -func (m *QueryExpiresRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryExpiresRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryExpiresRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryExpiresRequest proto.InternalMessageInfo - -// QueryExpiresResponse is the response type for the Query/Expires RPC method -type QueryExpiresResponse struct { - Expires uint64 `protobuf:"varint,1,opt,name=expires,proto3" json:"expires,omitempty"` -} - -func (m *QueryExpiresResponse) Reset() { *m = QueryExpiresResponse{} } -func (m *QueryExpiresResponse) String() string { return proto.CompactTextString(m) } -func (*QueryExpiresResponse) ProtoMessage() {} -func (*QueryExpiresResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_716e6efac23cde5d, []int{3} -} -func (m *QueryExpiresResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryExpiresResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryExpiresResponse.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 *QueryExpiresResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryExpiresResponse.Merge(m, src) -} -func (m *QueryExpiresResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryExpiresResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryExpiresResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryExpiresResponse proto.InternalMessageInfo - -// QueryHasUserRequest is the request type for the Query/HasUser RPC method -type QueryHasUserRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` -} - -func (m *QueryHasUserRequest) Reset() { *m = QueryHasUserRequest{} } -func (m *QueryHasUserRequest) String() string { return proto.CompactTextString(m) } -func (*QueryHasUserRequest) ProtoMessage() {} -func (*QueryHasUserRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_716e6efac23cde5d, []int{4} -} -func (m *QueryHasUserRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryHasUserRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryHasUserRequest.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 *QueryHasUserRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryHasUserRequest.Merge(m, src) -} -func (m *QueryHasUserRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryHasUserRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryHasUserRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryHasUserRequest proto.InternalMessageInfo - -// QueryHasUserResponse is the response type for the Query/HasUser RPC method -type QueryHasUserResponse struct { - HasUser bool `protobuf:"varint,1,opt,name=has_user,json=hasUser,proto3" json:"has_user,omitempty"` -} - -func (m *QueryHasUserResponse) Reset() { *m = QueryHasUserResponse{} } -func (m *QueryHasUserResponse) String() string { return proto.CompactTextString(m) } -func (*QueryHasUserResponse) ProtoMessage() {} -func (*QueryHasUserResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_716e6efac23cde5d, []int{5} -} -func (m *QueryHasUserResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryHasUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryHasUserResponse.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 *QueryHasUserResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryHasUserResponse.Merge(m, src) -} -func (m *QueryHasUserResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryHasUserResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryHasUserResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryHasUserResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*QueryUserRequest)(nil), "irismod.rental.QueryUserRequest") - proto.RegisterType((*QueryUserResponse)(nil), "irismod.rental.QueryUserResponse") - proto.RegisterType((*QueryExpiresRequest)(nil), "irismod.rental.QueryExpiresRequest") - proto.RegisterType((*QueryExpiresResponse)(nil), "irismod.rental.QueryExpiresResponse") - proto.RegisterType((*QueryHasUserRequest)(nil), "irismod.rental.QueryHasUserRequest") - proto.RegisterType((*QueryHasUserResponse)(nil), "irismod.rental.QueryHasUserResponse") -} - -func init() { proto.RegisterFile("rental/query.proto", fileDescriptor_716e6efac23cde5d) } - -var fileDescriptor_716e6efac23cde5d = []byte{ - // 433 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x53, 0x4f, 0x8f, 0xd2, 0x40, - 0x1c, 0x6d, 0x11, 0x28, 0xce, 0xc1, 0xe8, 0x88, 0x09, 0x34, 0xa6, 0xc1, 0x6a, 0x22, 0xf1, 0x4f, - 0x07, 0xc5, 0x4f, 0x60, 0x34, 0xca, 0xc1, 0x83, 0x4d, 0xbc, 0x78, 0x21, 0x85, 0x0e, 0xa5, 0x49, - 0x99, 0x29, 0x9d, 0x69, 0x22, 0x21, 0x5c, 0xbc, 0xe9, 0x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00, 0x00, 0xff, 0xff, 0xc6, 0xb7, 0x19, 0x48, 0xb7, 0x03, 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 { - // - User(ctx context.Context, in *QueryUserRequest, opts ...grpc.CallOption) (*QueryUserResponse, error) - Expires(ctx context.Context, in *QueryExpiresRequest, opts ...grpc.CallOption) (*QueryExpiresResponse, error) - HasUser(ctx context.Context, in *QueryHasUserRequest, opts ...grpc.CallOption) (*QueryHasUserResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) User(ctx context.Context, in *QueryUserRequest, opts ...grpc.CallOption) (*QueryUserResponse, error) { - out := new(QueryUserResponse) - err := c.cc.Invoke(ctx, "/irismod.rental.Query/User", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Expires(ctx context.Context, in *QueryExpiresRequest, opts ...grpc.CallOption) (*QueryExpiresResponse, error) { - out := new(QueryExpiresResponse) - err := c.cc.Invoke(ctx, "/irismod.rental.Query/Expires", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) HasUser(ctx context.Context, in *QueryHasUserRequest, opts ...grpc.CallOption) (*QueryHasUserResponse, error) { - out := new(QueryHasUserResponse) - err := c.cc.Invoke(ctx, "/irismod.rental.Query/HasUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // - User(context.Context, *QueryUserRequest) (*QueryUserResponse, error) - Expires(context.Context, *QueryExpiresRequest) (*QueryExpiresResponse, error) - HasUser(context.Context, *QueryHasUserRequest) (*QueryHasUserResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) User(ctx context.Context, req *QueryUserRequest) (*QueryUserResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method User not implemented") -} -func (*UnimplementedQueryServer) Expires(ctx context.Context, req *QueryExpiresRequest) (*QueryExpiresResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Expires not implemented") -} -func (*UnimplementedQueryServer) HasUser(ctx context.Context, req *QueryHasUserRequest) (*QueryHasUserResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method HasUser not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_User_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryUserRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).User(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.rental.Query/User", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).User(ctx, req.(*QueryUserRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Expires_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryExpiresRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Expires(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.rental.Query/Expires", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Expires(ctx, req.(*QueryExpiresRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_HasUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryHasUserRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).HasUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.rental.Query/HasUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).HasUser(ctx, req.(*QueryHasUserRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.rental.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "User", - Handler: _Query_User_Handler, - }, - { - MethodName: "Expires", - Handler: _Query_Expires_Handler, - }, - { - MethodName: "HasUser", - Handler: _Query_HasUser_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "rental/query.proto", -} - -func (m *QueryUserRequest) 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 *QueryUserRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryUserResponse) 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 *QueryUserResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.User) > 0 { - i -= len(m.User) - copy(dAtA[i:], m.User) - i = encodeVarintQuery(dAtA, i, uint64(len(m.User))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryExpiresRequest) 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 *QueryExpiresRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryExpiresRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryExpiresResponse) 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 *QueryExpiresResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryExpiresResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Expires != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Expires)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *QueryHasUserRequest) 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 *QueryHasUserRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryHasUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryHasUserResponse) 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 *QueryHasUserResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryHasUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.HasUser { - i-- - if m.HasUser { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x8 - } - 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 *QueryUserRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryUserResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.User) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryExpiresRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryExpiresResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Expires != 0 { - n += 1 + sovQuery(uint64(m.Expires)) - } - return n -} - -func (m *QueryHasUserRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryHasUserResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HasUser { - n += 2 - } - 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 *QueryUserRequest) 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: QueryUserRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUserRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - 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 *QueryUserResponse) 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: QueryUserResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.User = string(dAtA[iNdEx:postIndex]) - 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 *QueryExpiresRequest) 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: QueryExpiresRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExpiresRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - 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 *QueryExpiresResponse) 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: QueryExpiresResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExpiresResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) - } - m.Expires = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Expires |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - 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 *QueryHasUserRequest) 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: QueryHasUserRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHasUserRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - 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 *QueryHasUserResponse) 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: QueryHasUserResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryHasUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field HasUser", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.HasUser = bool(v != 0) - 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/modules/rental/types/query.pb.gw.go b/modules/rental/types/query.pb.gw.go deleted file mode 100644 index 14c428b8..00000000 --- a/modules/rental/types/query.pb.gw.go +++ /dev/null @@ -1,457 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: rental/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -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 - -func request_Query_User_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUserRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := client.User(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_User_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryUserRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := server.User(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Expires_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryExpiresRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := client.Expires(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Expires_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryExpiresRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := server.Expires(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryHasUserRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := client.HasUser(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryHasUserRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["class_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") - } - - protoReq.ClassId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) - } - - val, ok = pathParams["nft_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "nft_id") - } - - protoReq.NftId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "nft_id", err) - } - - msg, err := server.HasUser(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_User_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_User_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_User_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Expires_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_Expires_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_Expires_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_HasUser_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_HasUser_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_HasUser_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_User_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_User_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_User_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Expires_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_Expires_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_Expires_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_HasUser_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_HasUser_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_HasUser_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_User_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "user", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Expires_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "expires", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_HasUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "has_user", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_User_0 = runtime.ForwardResponseMessage - - forward_Query_Expires_0 = runtime.ForwardResponseMessage - - forward_Query_HasUser_0 = runtime.ForwardResponseMessage -) diff --git a/modules/rental/types/tx.pb.go b/modules/rental/types/tx.pb.go deleted file mode 100644 index e0652a28..00000000 --- a/modules/rental/types/tx.pb.go +++ /dev/null @@ -1,684 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: rental/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - 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" - 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 - -// MsgSetUser defines the Msg/SetUser response type. -type MsgSetUser struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` - NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"` - Expires uint64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` - Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` -} - -func (m *MsgSetUser) Reset() { *m = MsgSetUser{} } -func (m *MsgSetUser) String() string { return proto.CompactTextString(m) } -func (*MsgSetUser) ProtoMessage() {} -func (*MsgSetUser) Descriptor() ([]byte, []int) { - return fileDescriptor_94fd51cc9a4073b5, []int{0} -} -func (m *MsgSetUser) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetUser) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetUser.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 *MsgSetUser) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetUser.Merge(m, src) -} -func (m *MsgSetUser) XXX_Size() int { - return m.Size() -} -func (m *MsgSetUser) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetUser.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetUser proto.InternalMessageInfo - -// MsgSetUserResponse defines the Msg/SetUser response type. -type MsgSetUserResponse struct { -} - -func (m *MsgSetUserResponse) Reset() { *m = MsgSetUserResponse{} } -func (m *MsgSetUserResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSetUserResponse) ProtoMessage() {} -func (*MsgSetUserResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_94fd51cc9a4073b5, []int{1} -} -func (m *MsgSetUserResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSetUserResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSetUserResponse.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 *MsgSetUserResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSetUserResponse.Merge(m, src) -} -func (m *MsgSetUserResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSetUserResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSetUserResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSetUserResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgSetUser)(nil), "irismod.rental.MsgSetUser") - proto.RegisterType((*MsgSetUserResponse)(nil), "irismod.rental.MsgSetUserResponse") -} - -func init() { proto.RegisterFile("rental/tx.proto", fileDescriptor_94fd51cc9a4073b5) } - -var fileDescriptor_94fd51cc9a4073b5 = []byte{ - // 281 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xb1, 0x4e, 0xc3, 0x30, - 0x10, 0x86, 0x63, 0xda, 0x26, 0xe0, 0x01, 0x24, 0xab, 0xa0, 0x90, 0xc1, 0xaa, 0x32, 0x75, 0x8a, - 0x25, 0x78, 0x03, 0xb6, 0x0a, 0x65, 0x09, 0x62, 0x61, 0x41, 0x6d, 0x7d, 0x0d, 0x91, 0x12, 0x3b, - 0xf2, 0x39, 0x52, 0xd9, 0x79, 0x00, 0x1e, 0xab,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0x61, - 0xdf, 0x9a, 0x55, 0xb2, 0xd6, 0x95, 0xe8, 0xdd, 0x14, 0x58, 0x71, 0x74, 0x15, 0x95, 0x96, 0x4d, - 0x09, 0x28, 0x86, 0xa2, 0xdf, 0x6b, 0xc0, 0x95, 0xef, 0x6a, 0xbc, 0xff, 0x0d, 0x00, 0x00, 0xff, - 0xff, 0x56, 0xff, 0x6c, 0xf6, 0x7f, 0x01, 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 { - // SetUser defines a method for issue an nft - SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.CallOption) (*MsgSetUserResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) SetUser(ctx context.Context, in *MsgSetUser, opts ...grpc.CallOption) (*MsgSetUserResponse, error) { - out := new(MsgSetUserResponse) - err := c.cc.Invoke(ctx, "/irismod.rental.Msg/SetUser", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // SetUser defines a method for issue an nft - SetUser(context.Context, *MsgSetUser) (*MsgSetUserResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) SetUser(ctx context.Context, req *MsgSetUser) (*MsgSetUserResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetUser not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_SetUser_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSetUser) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).SetUser(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/irismod.rental.Msg/SetUser", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SetUser(ctx, req.(*MsgSetUser)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "irismod.rental.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "SetUser", - Handler: _Msg_SetUser_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "rental/tx.proto", -} - -func (m *MsgSetUser) 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 *MsgSetUser) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetUser) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - i -= len(m.Sender) - copy(dAtA[i:], m.Sender) - i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) - i-- - dAtA[i] = 0x2a - } - if m.Expires != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Expires)) - i-- - dAtA[i] = 0x20 - } - if len(m.User) > 0 { - i -= len(m.User) - copy(dAtA[i:], m.User) - i = encodeVarintTx(dAtA, i, uint64(len(m.User))) - i-- - dAtA[i] = 0x1a - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintTx(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x12 - } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgSetUserResponse) 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 *MsgSetUserResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSetUserResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgSetUser) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ClassId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.User) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if m.Expires != 0 { - n += 1 + sovTx(uint64(m.Expires)) - } - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgSetUserResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgSetUser) 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 ErrIntOverflowTx - } - 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: MsgSetUser: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetUser: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClassId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.User = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) - } - m.Expires = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Expires |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSetUserResponse) 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 ErrIntOverflowTx - } - 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: MsgSetUserResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSetUserResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTx(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, ErrIntOverflowTx - } - 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, ErrIntOverflowTx - } - 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, ErrIntOverflowTx - } - 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, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/proto/nft/nft.proto b/proto/nft/nft.proto index c1163cce..594f0c0e 100644 --- a/proto/nft/nft.proto +++ b/proto/nft/nft.proto @@ -50,6 +50,9 @@ message DenomMetadata { bool mint_restricted = 3; bool update_restricted = 4; string data = 5; + + // rental options + bool rental_enabled = 7; } // IDCollection defines a type of collection with specified ID diff --git a/proto/nft/query.proto b/proto/nft/query.proto index 912d5d8b..92b515b5 100644 --- a/proto/nft/query.proto +++ b/proto/nft/query.proto @@ -39,6 +39,25 @@ service Query { rpc NFT(QueryNFTRequest) returns (QueryNFTResponse) { option (google.api.http).get = "/irismod/nft/nfts/{denom_id}/{token_id}"; } + + // Rental Plugin Query Service + + // UserOf queries the user/renter of an NFT + rpc UserOf(QueryUserOfRequest) returns (QueryUserOfResponse) { + option (google.api.http).get = "/irismod/rental/user/{class_id}/{nft_id}"; + } + + // UserOf queries the rental expiry of an NFT + rpc UserExpires(QueryUserExpiresRequest) returns (QueryUserExpiresResponse) { + option (google.api.http).get = + "/irismod/rental/expires/{class_id}/{nft_id}"; + } + + // HasUser queries if an NFT has a user/renter + rpc HasUser(QueryHasUserRequest) returns (QueryHasUserResponse) { + option (google.api.http).get = + "/irismod/rental/has_user/{class_id}/{nft_id}"; + } } // QuerySupplyRequest is the request type for the Query/HTLC RPC method @@ -109,4 +128,33 @@ message QueryNFTRequest { } // QueryNFTResponse is the response type for the Query/NFT RPC method -message QueryNFTResponse { BaseNFT nft = 1 [ (gogoproto.customname) = "NFT" ]; } \ No newline at end of file +message QueryNFTResponse { BaseNFT nft = 1 [ (gogoproto.customname) = "NFT" ]; } + +// Rental Plugin Query Message Definition + +// QueryUserOfRequest is the request type for the Query/Renter RPC method +message QueryUserOfRequest { + string class_id = 1; + string nft_id = 2; +} + +// QueryUserOfResponse is the response type for the Query/Renter RPC method +message QueryUserOfResponse { string user = 1; } + +// QueryExpiresRequest is the request type for the Query/Expires RPC method +message QueryUserExpiresRequest { + string class_id = 1; + string nft_id = 2; +} + +// QueryExpiresResponse is the response type for the Query/Expires RPC method +message QueryUserExpiresResponse { uint64 expires = 1; } + +// QueryHasUserRequest is the request type for the Query/HasUser RPC method +message QueryHasUserRequest { + string class_id = 1; + string nft_id = 2; +} + +// QueryHasUserResponse is the response type for the Query/HasUser RPC method +message QueryHasUserResponse { bool has_user = 1; } \ No newline at end of file diff --git a/proto/rental/rental.proto b/proto/nft/rental.proto similarity index 75% rename from proto/rental/rental.proto rename to proto/nft/rental.proto index bba341c2..c998f600 100644 --- a/proto/rental/rental.proto +++ b/proto/nft/rental.proto @@ -3,7 +3,7 @@ package irismod.rental; import "gogoproto/gogo.proto"; -option go_package = "github.com/irisnet/irismod/modules/rental/types"; +option go_package = "github.com/irisnet/irismod/modules/nft/types"; // RentalInfo defines a rental info message RentalInfo { diff --git a/proto/nft/tx.proto b/proto/nft/tx.proto index a4a49282..3ada73d6 100644 --- a/proto/nft/tx.proto +++ b/proto/nft/tx.proto @@ -25,6 +25,11 @@ service Msg { // TransferDenom defines a method for transferring a denom. rpc TransferDenom(MsgTransferDenom) returns (MsgTransferDenomResponse); + + // Rental Plugin Service + + // SetUser defines a method for set user for an NFT. + rpc SetUser(MsgSetUser) returns (MsgSetUserResponse) {} } // MsgIssueDenom defines an SDK message for creating a new denom. @@ -120,3 +125,15 @@ message MsgTransferDenom { // MsgTransferDenomResponse defines the Msg/TransferDenom response type. message MsgTransferDenomResponse {} + +// MsgSetUser defines the Msg/SetUser response type. +message MsgSetUser { + string class_id = 1; + string nft_id = 2; + string user = 3; + uint64 expires = 4; + string sender = 5; +} + +// MsgSetUserResponse defines the Msg/SetUser response type. +message MsgSetUserResponse {} \ No newline at end of file diff --git a/proto/rental/genesis.proto b/proto/rental/genesis.proto deleted file mode 100644 index 6ad6b922..00000000 --- a/proto/rental/genesis.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package irismod.rental; - -import "gogoproto/gogo.proto"; -import "rental/rental.proto"; - -option go_package = "github.com/irisnet/irismod/modules/rental/types"; - -// GenesisState defines the rental module's genesis state -message GenesisState { - repeated RentalInfo renterInfos = 1 [ (gogoproto.nullable) = false ]; -} \ No newline at end of file diff --git a/proto/rental/query.proto b/proto/rental/query.proto deleted file mode 100644 index 41e5c73c..00000000 --- a/proto/rental/query.proto +++ /dev/null @@ -1,51 +0,0 @@ -syntax = "proto3"; -package irismod.rental; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; - -option go_package = "github.com/irisnet/irismod/modules/rental/types"; -option (gogoproto.goproto_getters_all) = false; - -// Query defines the gPRC querier service for rental module. -service Query { - // - rpc User(QueryUserRequest) returns (QueryUserResponse) { - option (google.api.http).get = "/irismod/rental/user/{class_id}/{nft_id}"; - }; - rpc Expires(QueryExpiresRequest) returns (QueryExpiresResponse) { - option (google.api.http).get = - "/irismod/rental/expires/{class_id}/{nft_id}"; - }; - rpc HasUser(QueryHasUserRequest) returns (QueryHasUserResponse) { - option (google.api.http).get = - "/irismod/rental/has_user/{class_id}/{nft_id}"; - } -} - -// QueryUserRequest is the request type for the Query/Renter RPC method -message QueryUserRequest { - string class_id = 1; - string nft_id = 2; -} - -// QueryUserResponse is the response type for the Query/Renter RPC method -message QueryUserResponse { string user = 1; } - -// QueryExpiresRequest is the request type for the Query/Expires RPC method -message QueryExpiresRequest { - string class_id = 1; - string nft_id = 2; -} - -// QueryExpiresResponse is the response type for the Query/Expires RPC method -message QueryExpiresResponse { uint64 expires = 1; } - -// QueryHasUserRequest is the request type for the Query/HasUser RPC method -message QueryHasUserRequest { - string class_id = 1; - string nft_id = 2; -} - -// QueryHasUserResponse is the response type for the Query/HasUser RPC method -message QueryHasUserResponse { bool has_user = 1; } \ No newline at end of file diff --git a/proto/rental/tx.proto b/proto/rental/tx.proto deleted file mode 100644 index 844be29f..00000000 --- a/proto/rental/tx.proto +++ /dev/null @@ -1,25 +0,0 @@ -syntax = "proto3"; -package irismod.rental; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/irisnet/irismod/modules/rental/types"; -option (gogoproto.goproto_getters_all) = false; - -// Msg defines the rental Msg service. -service Msg { - // SetUser defines a method for issue an nft - rpc SetUser(MsgSetUser) returns (MsgSetUserResponse) {} -} - -// MsgSetUser defines the Msg/SetUser response type. -message MsgSetUser { - string class_id = 1; - string nft_id = 2; - string user = 3; - uint64 expires = 4; - string sender = 5; -} - -// MsgSetUserResponse defines the Msg/SetUser response type. -message MsgSetUserResponse {} \ No newline at end of file From a185f4df05c6398f5d6a1fee31e7d830fc30c1c5 Mon Sep 17 00:00:00 2001 From: yuandu Date: Mon, 19 Dec 2022 17:16:22 +0800 Subject: [PATCH 12/20] add unit test --- modules/nft/keeper/grpc_query_rental_test.go | 66 +++++ modules/nft/keeper/keeper_test.go | 2 + modules/nft/keeper/msg_server_rental.go | 7 +- modules/nft/keeper/rental.go | 11 +- modules/nft/keeper/rental_test.go | 68 +++++ modules/nft/types/errors.go | 2 +- modules/nft/types/msgs.go | 58 ++++ modules/nft/types/nft.pb.go | 285 +++++++++++++++---- modules/nft/types/query.pb.go | 126 ++++---- modules/nft/types/rental.pb.go | 10 +- modules/nft/types/tx.pb.go | 94 +++--- proto/nft/nft.proto | 9 +- proto/nft/query.proto | 2 +- proto/nft/rental.proto | 2 +- proto/nft/tx.proto | 2 +- simapp/app.go | 20 +- 16 files changed, 560 insertions(+), 204 deletions(-) create mode 100644 modules/nft/keeper/grpc_query_rental_test.go create mode 100644 modules/nft/keeper/rental_test.go diff --git a/modules/nft/keeper/grpc_query_rental_test.go b/modules/nft/keeper/grpc_query_rental_test.go new file mode 100644 index 00000000..9fc0ae53 --- /dev/null +++ b/modules/nft/keeper/grpc_query_rental_test.go @@ -0,0 +1,66 @@ +package keeper_test + +import ( + "fmt" + "github.com/irisnet/irismod/modules/nft/types" +) + +func (suite *KeeperSuite) TestUserOf() { + expiry := suite.ctx.BlockTime().Unix() + 10 + + err := suite.keeper.Rent(suite.ctx, + types.RentalInfo{ + User: rentalRenter.String(), + ClassId: rentalDenomId, + NftId: rentalNftId, + Expires: expiry, + }) + suite.NoError(err) + + resp, err := suite.keeper.UserOf(suite.ctx, &types.QueryUserOfRequest{ + ClassId: rentalDenomId, + NftId: rentalNftId, + }) + suite.NoError(err) + suite.Equal(rentalRenter.String(), resp.User) +} + +func (suite *KeeperSuite) TestUserExpires() { + expiry := suite.ctx.BlockTime().Unix() + 10 + fmt.Print(expiry) + err := suite.keeper.Rent(suite.ctx, + types.RentalInfo{ + User: rentalRenter.String(), + ClassId: rentalDenomId, + NftId: rentalNftId, + Expires: expiry, + }) + suite.NoError(err) + + resp, err := suite.keeper.UserExpires(suite.ctx, &types.QueryUserExpiresRequest{ + ClassId: rentalDenomId, + NftId: rentalNftId, + }) + suite.NoError(err) + suite.Equal(expiry, resp.Expires) +} + +func (suite *KeeperSuite) TestHasUser() { + expiry := suite.ctx.BlockTime().Unix() + 10 + + err := suite.keeper.Rent(suite.ctx, + types.RentalInfo{ + User: rentalRenter.String(), + ClassId: rentalDenomId, + NftId: rentalNftId, + Expires: expiry, + }) + suite.NoError(err) + + resp, err := suite.keeper.HasUser(suite.ctx, &types.QueryHasUserRequest{ + ClassId: rentalDenomId, + NftId: rentalNftId, + }) + suite.NoError(err) + suite.Equal(true, resp.HasUser) +} diff --git a/modules/nft/keeper/keeper_test.go b/modules/nft/keeper/keeper_test.go index 2a8cae1e..60e0e94c 100644 --- a/modules/nft/keeper/keeper_test.go +++ b/modules/nft/keeper/keeper_test.go @@ -94,6 +94,8 @@ func (suite *KeeperSuite) SetupTest() { suite.NoError(err) suite.NotEmpty(collections) suite.Equal(len(collections), 3) + + suite.SetupRentalTest() } func TestKeeperSuite(t *testing.T) { diff --git a/modules/nft/keeper/msg_server_rental.go b/modules/nft/keeper/msg_server_rental.go index 27ed44e0..d9d2e691 100644 --- a/modules/nft/keeper/msg_server_rental.go +++ b/modules/nft/keeper/msg_server_rental.go @@ -23,6 +23,11 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms ctx := sdk.UnwrapSDKContext(goCtx) + // nft must exist + if exist := k.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + } + // sender must own or be approved for this nft if owner := k.nk.GetOwner(ctx, msg.ClassId, msg.NftId); !owner.Equals(sender) { return nil, sdkerrors.Wrapf(types.ErrUnauthorized, "%s is not owner of the nft", msg.Sender) @@ -42,7 +47,7 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms types.EventTypeSetUser, sdk.NewAttribute(types.AttributeKeyDenomID, msg.ClassId), sdk.NewAttribute(types.AttributeKeyTokenID, msg.NftId), - sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatUint(msg.Expires, 10)), + sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatInt(msg.Expires, 10)), sdk.NewAttribute(types.AttributeKeyUser, msg.User), ), sdk.NewEvent( diff --git a/modules/nft/keeper/rental.go b/modules/nft/keeper/rental.go index 88738d3a..5ddd5d9d 100644 --- a/modules/nft/keeper/rental.go +++ b/modules/nft/keeper/rental.go @@ -8,9 +8,12 @@ import ( // Rent set or update rental info for an nft. func (k Keeper) Rent(ctx sdk.Context, rental types.RentalInfo) error { - // this nft must expire if to be set again. - // FIXME: proto should use int64 or Time than uint64 - rental, exist := k.GetRentalInfo(ctx, rental.ClassId, rental.NftId) + + // rent option is enabled + // todo + + // this nft must expire to be set again. + _, exist := k.GetRentalInfo(ctx, rental.ClassId, rental.NftId) if exist && ctx.BlockTime().Unix() < int64(rental.Expires) { return sdkerrors.Wrapf(types.ErrInvalidExpiry, "Expiry is (%d)", rental.Expires) } @@ -23,7 +26,7 @@ func (k Keeper) Rent(ctx sdk.Context, rental types.RentalInfo) error { // setRentalInfo sets the rental info for an nft. func (k Keeper) setRentalInfo(ctx sdk.Context, classId, nftId, user string, - expires uint64) { + expires int64) { store := ctx.KVStore(k.storeKey) r := types.RentalInfo{ User: user, diff --git a/modules/nft/keeper/rental_test.go b/modules/nft/keeper/rental_test.go new file mode 100644 index 00000000..d6acab77 --- /dev/null +++ b/modules/nft/keeper/rental_test.go @@ -0,0 +1,68 @@ +package keeper_test + +import ( + "encoding/json" + "github.com/irisnet/irismod/modules/nft/types" +) + +var ( + rentalDenomId = "rentalDenomId" + rentalDenomName = "rentalDenomName" + rentalSchema = "rental schema" + rentalSymbol = "ren" + rentalNftId = "rentalNftId" + rentalNftName = "rentalNftName" + + rentalCreator = CreateTestAddrs(4)[3] + rentalRenter = CreateTestAddrs(5)[4] + + rentalUserData = types.DenomUserData{ + RentalEnabled: true, + UserData: "", + } +) + +func (suite *KeeperSuite) SetupRentalTest() { + + data, err := json.Marshal(&rentalUserData) + suite.NoError(err) + + err = suite.keeper.SaveDenom(suite.ctx, + rentalDenomId, + rentalDenomName, + rentalSchema, + rentalSymbol, + rentalCreator, + false, + false, + "", + "", + "", + string(data), + ) + suite.NoError(err) + + err = suite.keeper.SaveNFT(suite.ctx, + rentalDenomId, + rentalNftId, + rentalNftName, + "", + "", + "", + rentalCreator, + ) + suite.NoError(err) +} + +func (suite *KeeperSuite) TestSetUser() { + expiry := suite.ctx.BlockTime().Unix() + 10 + + err := suite.keeper.Rent(suite.ctx, + types.RentalInfo{ + User: rentalRenter.String(), + ClassId: rentalDenomId, + NftId: rentalNftId, + Expires: expiry, + }) + suite.NoError(err) +} diff --git a/modules/nft/types/errors.go b/modules/nft/types/errors.go index 1f33e8af..88db665f 100644 --- a/modules/nft/types/errors.go +++ b/modules/nft/types/errors.go @@ -16,7 +16,7 @@ var ( ErrInvalidTokenID = sdkerrors.Register(ModuleName, 17, "invalid nft id") ErrInvalidTokenURI = sdkerrors.Register(ModuleName, 18, "invalid nft uri") - // Renal Plugin Errors + // Rental Plugin Errors ErrInvalidExpiry = sdkerrors.Register(ModuleName, 31, "invalid expiry") ErrNotExistentRentalInfo = sdkerrors.Register(ModuleName, 32, "rental info is not existent") ) diff --git a/modules/nft/types/msgs.go b/modules/nft/types/msgs.go index 12e47593..0811e5ae 100644 --- a/modules/nft/types/msgs.go +++ b/modules/nft/types/msgs.go @@ -3,6 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/nft" ) // constant used to indicate that some field should not be updated @@ -13,6 +14,8 @@ const ( TypeMsgMintNFT = "mint_nft" TypeMsgBurnNFT = "burn_nft" TypeMsgTransferDenom = "transfer_denom" + + TypeMsgSetUser = "set_user" ) var ( @@ -22,6 +25,8 @@ var ( _ sdk.Msg = &MsgMintNFT{} _ sdk.Msg = &MsgBurnNFT{} _ sdk.Msg = &MsgTransferDenom{} + + _ sdk.Msg = &MsgSetUser{} ) // NewMsgIssueDenom is a constructor function for MsgSetName @@ -323,3 +328,56 @@ func (msg MsgTransferDenom) GetSigners() []sdk.AccAddress { } return []sdk.AccAddress{from} } + +func NewMsgSetUser(classId, nftId, user string, + expires int64, sender string) *MsgSetUser { + return &MsgSetUser{ + ClassId: classId, + NftId: nftId, + User: user, + Expires: expires, + Sender: sender, + } +} + +// Route Implements LegacyMsg +func (m MsgSetUser) Route() string { return RouterKey } + +// Type Implements LegacyMsg +func (m MsgSetUser) Type() string { return TypeMsgSetUser } + +// GetSignBytes Implements LegacyMsg +func (m MsgSetUser) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(&m) + return sdk.MustSortJSON(bz) +} + +// ValidateBasic implements the Msg.ValidateBasic method. +func (m MsgSetUser) ValidateBasic() error { + if err := nft.ValidateClassID(m.ClassId); err != nil { + return sdkerrors.Wrapf(ErrInvalidDenom, "Invalid class id (%s)", m.ClassId) + } + + if err := nft.ValidateNFTID(m.NftId); err != nil { + return sdkerrors.Wrapf(ErrInvalidTokenID, "Invalid nft id (%s)", m.NftId) + } + + _, err := sdk.AccAddressFromBech32(m.Sender) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", m.Sender) + } + + _, err = sdk.AccAddressFromBech32(m.User) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid user address (%s)", m.User) + + } + + return nil +} + +// GetSigners implements the Msg.GetSigners method. +func (m MsgSetUser) GetSigners() []sdk.AccAddress { + signer, _ := sdk.AccAddressFromBech32(m.Sender) + return []sdk.AccAddress{signer} +} diff --git a/modules/nft/types/nft.pb.go b/modules/nft/types/nft.pb.go index 78465300..15154398 100644 --- a/modules/nft/types/nft.pb.go +++ b/modules/nft/types/nft.pb.go @@ -158,8 +158,6 @@ type DenomMetadata struct { MintRestricted bool `protobuf:"varint,3,opt,name=mint_restricted,json=mintRestricted,proto3" json:"mint_restricted,omitempty"` UpdateRestricted bool `protobuf:"varint,4,opt,name=update_restricted,json=updateRestricted,proto3" json:"update_restricted,omitempty"` Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` - // rental options - RentalEnabled bool `protobuf:"varint,7,opt,name=rental_enabled,json=rentalEnabled,proto3" json:"rental_enabled,omitempty"` } func (m *DenomMetadata) Reset() { *m = DenomMetadata{} } @@ -195,6 +193,46 @@ func (m *DenomMetadata) XXX_DiscardUnknown() { var xxx_messageInfo_DenomMetadata proto.InternalMessageInfo +// DenomUserData defines user defined data and nft extensible options +type DenomUserData struct { + // bool royalty_enabled = 1; + RentalEnabled bool `protobuf:"varint,2,opt,name=rental_enabled,json=rentalEnabled,proto3" json:"rental_enabled,omitempty"` + UserData string `protobuf:"bytes,10,opt,name=user_data,json=userData,proto3" json:"user_data,omitempty"` +} + +func (m *DenomUserData) Reset() { *m = DenomUserData{} } +func (m *DenomUserData) String() string { return proto.CompactTextString(m) } +func (*DenomUserData) ProtoMessage() {} +func (*DenomUserData) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{4} +} +func (m *DenomUserData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomUserData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomUserData.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 *DenomUserData) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomUserData.Merge(m, src) +} +func (m *DenomUserData) XXX_Size() int { + return m.Size() +} +func (m *DenomUserData) XXX_DiscardUnknown() { + xxx_messageInfo_DenomUserData.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomUserData proto.InternalMessageInfo + // IDCollection defines a type of collection with specified ID type IDCollection struct { DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty" yaml:"denom_id"` @@ -205,7 +243,7 @@ func (m *IDCollection) Reset() { *m = IDCollection{} } func (m *IDCollection) String() string { return proto.CompactTextString(m) } func (*IDCollection) ProtoMessage() {} func (*IDCollection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{4} + return fileDescriptor_fe8ab7e15b7f0646, []int{5} } func (m *IDCollection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -244,7 +282,7 @@ func (m *Owner) Reset() { *m = Owner{} } func (m *Owner) String() string { return proto.CompactTextString(m) } func (*Owner) ProtoMessage() {} func (*Owner) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{5} + return fileDescriptor_fe8ab7e15b7f0646, []int{6} } func (m *Owner) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -283,7 +321,7 @@ func (m *Collection) Reset() { *m = Collection{} } func (m *Collection) String() string { return proto.CompactTextString(m) } func (*Collection) ProtoMessage() {} func (*Collection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{6} + return fileDescriptor_fe8ab7e15b7f0646, []int{7} } func (m *Collection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -317,6 +355,7 @@ func init() { proto.RegisterType((*NFTMetadata)(nil), "irismod.nft.NFTMetadata") proto.RegisterType((*Denom)(nil), "irismod.nft.Denom") proto.RegisterType((*DenomMetadata)(nil), "irismod.nft.DenomMetadata") + proto.RegisterType((*DenomUserData)(nil), "irismod.nft.DenomUserData") proto.RegisterType((*IDCollection)(nil), "irismod.nft.IDCollection") proto.RegisterType((*Owner)(nil), "irismod.nft.Owner") proto.RegisterType((*Collection)(nil), "irismod.nft.Collection") @@ -325,48 +364,50 @@ func init() { func init() { proto.RegisterFile("nft/nft.proto", fileDescriptor_fe8ab7e15b7f0646) } var fileDescriptor_fe8ab7e15b7f0646 = []byte{ - // 654 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0x8e, 0x1d, 0xa7, 0x4e, 0xc6, 0x4d, 0xda, 0x7f, 0xff, 0x08, 0xb9, 0x1c, 0xec, 0x2a, 0x02, - 0x51, 0x09, 0x94, 0x88, 0x22, 0x71, 0x28, 0x37, 0x53, 0x2a, 0x82, 0x44, 0x91, 0xac, 0x72, 0xe1, - 0x12, 0x6d, 0xbc, 0x9b, 0x66, 0x85, 0xed, 0x8d, 0xbc, 0x1b, 0x55, 0xe5, 0x25, 0x40, 0xe2, 0x05, - 0x78, 0x08, 0x1e, 0xa2, 0xc7, 0x1e, 0x7b, 0x8a, 0x20, 0xbd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 0x14, 0xf7, 0x0f, 0x12, - 0x4e, 0xe6, 0x31, 0x15, 0xf9, 0xd3, 0x36, 0x90, 0xe7, 0x33, 0x2a, 0xc6, 0x1b, 0xea, 0xf9, 0x7a, - 0xf6, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x99, 0x65, 0x62, 0xa1, 0xf2, 0x04, 0x00, 0x00, + // 679 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0xf3, 0xd3, 0x38, 0xeb, 0x26, 0x2d, 0x4b, 0x84, 0x5c, 0x90, 0xec, 0xca, 0x02, 0x51, + 0x09, 0x94, 0x88, 0x22, 0x71, 0x28, 0x37, 0x53, 0x2a, 0x82, 0x44, 0x91, 0x4c, 0x7b, 0xe1, 0x62, + 0x6d, 0xbc, 0x9b, 0x66, 0x85, 0xed, 0x8d, 0x76, 0xd7, 0xaa, 0xca, 0x4b, 0x80, 0xc4, 0x0b, 0xf0, + 0x0a, 0x48, 0x3c, 0x44, 0x8f, 0x3d, 0x72, 0x8a, 0x20, 0xbd, 0x70, 0xee, 0x13, 0x20, 0xef, 0xda, + 0xc1, 0x51, 0x41, 0xea, 0x6d, 0xe6, 0x9b, 0x6f, 0x67, 0xbe, 0xf9, 0xd6, 0x5e, 0xd0, 0x4d, 0x27, + 0x72, 0x98, 0x4e, 0xe4, 0x60, 0xc6, 0x99, 0x64, 0xd0, 0xa2, 0x9c, 0x8a, 0x84, 0xe1, 0x41, 0x3a, + 0x91, 0x77, 0xfb, 0x27, 0xec, 0x84, 0x29, 0x7c, 0x98, 0x47, 0x9a, 0xe2, 0x7d, 0x31, 0x40, 0xdb, + 0x47, 0x82, 0x1c, 0x1e, 0x1c, 0xc1, 0x1e, 0xa8, 0x53, 0x6c, 0x1b, 0xdb, 0xc6, 0x4e, 0x27, 0xa8, + 0x53, 0x0c, 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aa, 0x91, 0x55, 0x08, 0x6e, 0xea, 0x2b, + 0xe9, 0xa8, 0x8a, 0xba, 0x89, 0xaa, 0xbf, 0x60, 0xc5, 0xdf, 0xa5, 0x6d, 0xd6, 0x35, 0xdb, 0xbe, + 0x19, 0xa0, 0xab, 0x6c, 0x5b, 0xda, 0x5e, 0xb1, 0xc0, 0xb8, 0x6e, 0x81, 0x36, 0xad, 0xbe, 0x62, + 0xda, 0x3f, 0x2c, 0x68, 0xdc, 0xdc, 0x82, 0xe6, 0x7f, 0x2c, 0x28, 0x35, 0xb7, 0xae, 0x69, 0x7e, + 0x57, 0x48, 0x3e, 0x16, 0x84, 0xef, 0xe7, 0x92, 0x1f, 0x80, 0x1e, 0x27, 0xa9, 0x44, 0x71, 0x48, + 0x52, 0x34, 0x8e, 0x09, 0x56, 0x02, 0xcd, 0xa0, 0xab, 0xd1, 0x97, 0x1a, 0x84, 0xf7, 0x40, 0x27, + 0x13, 0x84, 0x87, 0xaa, 0xad, 0x76, 0xc8, 0xcc, 0x8a, 0x1e, 0xde, 0x29, 0x58, 0x1f, 0xed, 0xbf, + 0x60, 0x71, 0x4c, 0x22, 0xe5, 0xef, 0x00, 0x98, 0x38, 0x1f, 0x12, 0x96, 0xdf, 0x92, 0x7f, 0xfb, + 0x6a, 0xee, 0x6e, 0x9c, 0xa1, 0x24, 0xde, 0xf3, 0xca, 0x8a, 0x17, 0xb4, 0x55, 0x38, 0xc2, 0xf0, + 0x09, 0xe8, 0x48, 0xf6, 0x81, 0xa4, 0x21, 0xc5, 0xc2, 0xae, 0x6f, 0x37, 0x76, 0x3a, 0x7e, 0xff, + 0x6a, 0xee, 0x6e, 0xea, 0x03, 0xcb, 0x92, 0x17, 0x98, 0x2a, 0x1e, 0x61, 0x51, 0x6c, 0xf3, 0xc9, + 0x00, 0xad, 0xb7, 0xea, 0x07, 0xb1, 0x41, 0x1b, 0x61, 0xcc, 0x89, 0x10, 0xa5, 0xf3, 0x45, 0x0a, + 0x27, 0xa0, 0x47, 0x71, 0x18, 0x2d, 0xd5, 0xe9, 0x09, 0xd6, 0xee, 0xd6, 0xa0, 0xf2, 0xaf, 0x0f, + 0xaa, 0xfa, 0xfd, 0xfb, 0xe7, 0x73, 0xb7, 0xb6, 0x98, 0xbb, 0xdd, 0x2a, 0x2a, 0xae, 0xe6, 0xae, + 0xa5, 0x15, 0x51, 0x1c, 0x09, 0x2f, 0xe8, 0x52, 0x5c, 0xa9, 0x16, 0x8a, 0x3e, 0x02, 0xb0, 0x62, + 0x44, 0x4b, 0xed, 0xa8, 0x34, 0x59, 0xbb, 0x70, 0x65, 0xa4, 0xba, 0x07, 0xbf, 0x99, 0xcf, 0x0a, + 0x34, 0x0d, 0x3e, 0x03, 0xcd, 0x74, 0x22, 0x4b, 0x85, 0xfd, 0x15, 0x7a, 0xf1, 0xe6, 0xf8, 0xeb, + 0x85, 0xb8, 0xe6, 0xe1, 0xc1, 0x91, 0x08, 0x14, 0x5f, 0xcf, 0xf6, 0x5f, 0x9f, 0xff, 0x72, 0x6a, + 0xe7, 0x0b, 0xc7, 0xb8, 0x58, 0x38, 0xc6, 0xcf, 0x85, 0x63, 0x7c, 0xbe, 0x74, 0x6a, 0x17, 0x97, + 0x4e, 0xed, 0xc7, 0xa5, 0x53, 0x7b, 0xff, 0xf8, 0x84, 0xca, 0x69, 0x36, 0x1e, 0x44, 0x2c, 0x19, + 0xe6, 0x7d, 0x53, 0x22, 0x87, 0x45, 0xff, 0x61, 0xc2, 0x70, 0x16, 0x13, 0x91, 0x3f, 0x84, 0x43, + 0x79, 0x36, 0x23, 0x62, 0xbc, 0xa6, 0x1e, 0xbb, 0xa7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x17, + 0xd5, 0xe0, 0x62, 0x20, 0x05, 0x00, 0x00, } func (this *BaseNFT) Equal(that interface{}) bool { @@ -523,9 +564,6 @@ func (this *DenomMetadata) Equal(that interface{}) bool { if this.Data != that1.Data { return false } - if this.RentalEnabled != that1.RentalEnabled { - return false - } return true } func (this *IDCollection) Equal(that interface{}) bool { @@ -852,16 +890,6 @@ func (m *DenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.RentalEnabled { - i-- - if m.RentalEnabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x38 - } if len(m.Data) > 0 { i -= len(m.Data) copy(dAtA[i:], m.Data) @@ -906,6 +934,46 @@ func (m *DenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DenomUserData) 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 *DenomUserData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomUserData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.UserData) > 0 { + i -= len(m.UserData) + copy(dAtA[i:], m.UserData) + i = encodeVarintNft(dAtA, i, uint64(len(m.UserData))) + i-- + dAtA[i] = 0x52 + } + if m.RentalEnabled { + i-- + if m.RentalEnabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x10 + } + return len(dAtA) - i, nil +} + func (m *IDCollection) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1172,9 +1240,22 @@ func (m *DenomMetadata) Size() (n int) { if l > 0 { n += 1 + l + sovNft(uint64(l)) } + return n +} + +func (m *DenomUserData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l if m.RentalEnabled { n += 2 } + l = len(m.UserData) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } return n } @@ -2138,7 +2219,57 @@ func (m *DenomMetadata) Unmarshal(dAtA []byte) error { } m.Data = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DenomUserData) 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 ErrIntOverflowNft + } + 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: DenomUserData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomUserData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field RentalEnabled", wireType) } @@ -2158,6 +2289,38 @@ func (m *DenomMetadata) Unmarshal(dAtA []byte) error { } } m.RentalEnabled = bool(v != 0) + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserData", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipNft(dAtA[iNdEx:]) diff --git a/modules/nft/types/query.pb.go b/modules/nft/types/query.pb.go index c9a25f5e..9e2d4851 100644 --- a/modules/nft/types/query.pb.go +++ b/modules/nft/types/query.pb.go @@ -794,7 +794,7 @@ func (m *QueryUserExpiresRequest) GetNftId() string { // QueryExpiresResponse is the response type for the Query/Expires RPC method type QueryUserExpiresResponse struct { - Expires uint64 `protobuf:"varint,1,opt,name=expires,proto3" json:"expires,omitempty"` + Expires int64 `protobuf:"varint,1,opt,name=expires,proto3" json:"expires,omitempty"` } func (m *QueryUserExpiresResponse) Reset() { *m = QueryUserExpiresResponse{} } @@ -830,7 +830,7 @@ func (m *QueryUserExpiresResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryUserExpiresResponse proto.InternalMessageInfo -func (m *QueryUserExpiresResponse) GetExpires() uint64 { +func (m *QueryUserExpiresResponse) GetExpires() int64 { if m != nil { return m.Expires } @@ -960,68 +960,68 @@ func init() { proto.RegisterFile("nft/query.proto", fileDescriptor_ce02d034d3adf var fileDescriptor_ce02d034d3adf2e9 = []byte{ // 996 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcf, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0xe6, 0x87, 0xed, 0xbe, 0x80, 0xd2, 0x4e, 0xd2, 0xd6, 0x31, 0xc5, 0x36, 0xd3, 0x36, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xc6, 0x89, 0xed, 0xbe, 0x80, 0xd2, 0x4e, 0xd2, 0xd6, 0x31, 0xc5, 0x36, 0xd3, 0x36, 0x4d, 0xd3, 0x74, 0xb7, 0x49, 0x2b, 0x21, 0x71, 0xe0, 0xe0, 0x80, 0x4b, 0x84, 0xd4, 0xc0, 0x52, 0x2e, 0x15, 0x52,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0xae, 0x68, - 0x71, 0x9f, 0x85, 0xa7, 0xce, 0x99, 0x2a, 0xfa, 0x29, 0x36, 0x13, 0x06, 0x99, 0x94, 0x5f, 0x03, - 0x32, 0xcb, 0x6f, 0xa0, 0x06, 0x40, 0xbf, 0x8b, 0xef, 0x97, 0x91, 0x8a, 0x64, 0x01, 0xac, 0xdc, - 0x05, 0x38, 0xb2, 0xb0, 0x1f, 0xa3, 0xf0, 0xa8, 0xef, 0x01, 0x14, 0x34, 0xbd, 0x2c, 0x5b, 0xf5, - 0x99, 0x6c, 0x81, 0x8d, 0xd9, 0x97, 0xc7, 0xb5, 0x29, 0x17, 0x71, 0xef, 0x2e, 0xeb, 0xfb, 0xb0, - 0x10, 0x75, 0x4d, 0xde, 0xeb, 0x69, 0x43, 0x49, 0x89, 0xef, 0x19, 0x0f, 0xf1, 0xd3, 0x67, 0xf1, - 0xd1, 0x0a, 0x75, 0x8b, 0xfa, 0x73, 0xbb, 0x4d, 0xb7, 0xe0, 0xf2, 0x84, 0x12, 0x33, 0xe0, 0xc0, - 0x0c, 0xf7, 0x15, 0xa6, 0x76, 0x29, 0x71, 0xfc, 0x86, 0x27, 0xd9, 0x93, 0xe6, 0xd3, 0x46, 0xf1, - 0xe4, 0xb8, 0x36, 0x13, 0xee, 0x09, 0x91, 0xb4, 0x89, 0x85, 0xfa, 0x56, 0xb2, 0xc1, 0x8e, 0x1f, - 0x49, 0x5f, 0x86, 0x52, 0xab, 0xe7, 0x49, 0x39, 0x96, 0xee, 0x16, 0xf5, 0x78, 0xbb, 0x4d, 0xae, - 0x42, 0x81, 0xfb, 0x6a, 0xac, 0xd1, 0x9d, 0xe3, 0xbe, 0xda, 0x6e, 0xd3, 0xbb, 0x58, 0x91, 0x28, - 0x0e, 0xea, 0x21, 0x30, 0x3b, 0x94, 0xe8, 0x17, 0x97, 0x5c, 0xfd, 0x4d, 0xbf, 0xc4, 0xee, 0x09, - 0xa1, 0x9f, 0xff, 0x14, 0x74, 0x07, 0x4c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0x9c, 0x17, 0x52, - 0x5e, 0x50, 0xf0, 0xa4, 0xd9, 0xd1, 0x0f, 0x34, 0xe9, 0x55, 0xb2, 0x98, 0x41, 0x4a, 0x24, 0x84, - 0x2d, 0x4e, 0x6e, 0x64, 0xd6, 0x2a, 0xe2, 0xf8, 0xf0, 0x9c, 0x55, 0x24, 0x70, 0x34, 0xc1, 0x5d, - 0x72, 0x27, 0x55, 0xc1, 0xf8, 0x55, 0x3a, 0x8c, 0x9c, 0x69, 0x44, 0x46, 0x50, 0x30, 0xed, 0x9f, - 0x75, 0xbc, 0x84, 0xc1, 0x64, 0x1d, 0x2f, 0xe9, 0x1c, 0xf4, 0x81, 0x66, 0x5f, 0x23, 0xab, 0x63, - 0xf6, 0x01, 0xe3, 0xca, 0xeb, 0x39, 0x61, 0x4f, 0x39, 0x87, 0x51, 0x9f, 0x8e, 0x9c, 0x43, 0xd3, - 0x97, 0x23, 0xf2, 0x9b, 0x05, 0xf3, 0x31, 0x1b, 0xc8, 0xba, 0xce, 0x69, 0xcb, 0xc9, 0xba, 0xce, - 0x19, 0x5e, 0x42, 0x1f, 0x6a, 0x39, 0xf7, 0xc9, 0xbd, 0xb3, 0x72, 0xd0, 0x52, 0x32, 0x15, 0xbd, - 0xb0, 0xa0, 0x88, 0xce, 0x40, 0x32, 0x4e, 0x9c, 0x74, 0x9f, 0xca, 0x47, 0x17, 0x20, 0x50, 0xc5, - 0x23, 0xad, 0xc2, 0x26, 0xeb, 0x67, 0x55, 0x44, 0x66, 0x93, 0x25, 0xa3, 0xd1, 0x7c, 0x79, 0x52, - 0xb5, 0x5e, 0x9d, 0x54, 0xad, 0x7f, 0x4e, 0xaa, 0xd6, 0xd1, 0x69, 0x75, 0xea, 0xd5, 0x69, 0x75, - 0xea, 0xef, 0xd3, 0xea, 0xd4, 0xb3, 0xf5, 0x4e, 0x57, 0xed, 0x0d, 0x77, 0xed, 0x96, 0xe8, 0xeb, - 0x88, 0x9c, 0xa9, 0x71, 0xe4, 0x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, 0xe6, 0xd9, 0x46, 0xbb, 0xa3, 0xf6, 0x07, 0x7b, 0x76, 0x53, 0xf4, + 0x74, 0x44, 0xce, 0xd4, 0x28, 0x72, 0x4f, 0xb4, 0x06, 0x5d, 0x26, 0x75, 0xd1, 0xd5, 0x61, 0xc0, + 0xe4, 0x5e, 0x5e, 0xff, 0x68, 0x3f, 0xfc, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x96, 0xfb, 0xda, 0xc6, 0xf7, 0x0b, 0x00, 0x00, } @@ -4000,7 +4000,7 @@ func (m *QueryUserExpiresResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Expires |= uint64(b&0x7F) << shift + m.Expires |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/modules/nft/types/rental.pb.go b/modules/nft/types/rental.pb.go index 3ee1e9dc..704b71b9 100644 --- a/modules/nft/types/rental.pb.go +++ b/modules/nft/types/rental.pb.go @@ -28,7 +28,7 @@ type RentalInfo struct { User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Expires uint64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` + Expires int64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` } func (m *RentalInfo) Reset() { *m = RentalInfo{} } @@ -85,7 +85,7 @@ func (m *RentalInfo) GetNftId() string { return "" } -func (m *RentalInfo) GetExpires() uint64 { +func (m *RentalInfo) GetExpires() int64 { if m != nil { return m.Expires } @@ -108,12 +108,12 @@ var fileDescriptor_e57beeaf512eaaa2 = []byte{ 0x2d, 0x24, 0xc9, 0xc5, 0x91, 0x9c, 0x93, 0x58, 0x5c, 0x1c, 0x9f, 0x99, 0x22, 0xc1, 0x04, 0x16, 0x67, 0x07, 0xf3, 0x3d, 0x53, 0x84, 0x44, 0xb9, 0xd8, 0xf2, 0xd2, 0x4a, 0x40, 0x12, 0xcc, 0x60, 0x09, 0xd6, 0xbc, 0xb4, 0x12, 0xcf, 0x14, 0x21, 0x09, 0x2e, 0xf6, 0xd4, 0x8a, 0x82, 0xcc, 0xa2, - 0xd4, 0x62, 0x09, 0x16, 0x05, 0x46, 0x0d, 0x96, 0x20, 0x18, 0xd7, 0xc9, 0xed, 0xc4, 0x23, 0x39, + 0xd4, 0x62, 0x09, 0x16, 0x05, 0x46, 0x0d, 0xe6, 0x20, 0x18, 0xd7, 0xc9, 0xed, 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, 0x74, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0x0e, 0xcf, 0x4b, 0x2d, 0xd1, 0x87, 0x7a, 0x40, 0x3f, 0x37, 0x3f, 0xa5, 0x34, 0x27, 0xb5, 0x58, 0x1f, 0xe4, 0xc5, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xe3, - 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfe, 0x7c, 0xd6, 0xac, 0xf6, 0x00, 0x00, 0x00, + 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x40, 0xf2, 0x50, 0x68, 0xf6, 0x00, 0x00, 0x00, } func (m *RentalInfo) Marshal() (dAtA []byte, err error) { @@ -345,7 +345,7 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Expires |= uint64(b&0x7F) << shift + m.Expires |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/modules/nft/types/tx.pb.go b/modules/nft/types/tx.pb.go index ead3421b..821b1566 100644 --- a/modules/nft/types/tx.pb.go +++ b/modules/nft/types/tx.pb.go @@ -518,7 +518,7 @@ type MsgSetUser struct { ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"` - Expires uint64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` + Expires int64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` } @@ -614,51 +614,51 @@ func init() { proto.RegisterFile("nft/tx.proto", fileDescriptor_09d30374d974e015 var fileDescriptor_09d30374d974e015 = []byte{ // 733 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0x8d, 0xf3, 0xe7, 0xe4, 0xe6, 0xeb, 0xcf, 0x37, 0xf4, 0xc7, 0x0d, 0x90, 0x54, 0x41, 0x88, - 0x4a, 0xa0, 0x44, 0x82, 0x5d, 0x97, 0x81, 0x22, 0x82, 0x08, 0x48, 0xa6, 0xdd, 0xb0, 0x20, 0x72, - 0xe3, 0x49, 0x32, 0x28, 0x1e, 0x47, 0x33, 0x63, 0xa9, 0xdd, 0xf3, 0x00, 0xf0, 0x06, 0x3c, 0x07, - 0x4f, 0xd0, 0x65, 0x97, 0xac, 0x2a, 0x48, 0x25, 0x84, 0x58, 0xf2, 0x04, 0x28, 0xe3, 0xb1, 0x33, - 0x8e, 0x9b, 0xae, 0x58, 0x20, 0x76, 0x33, 0xe7, 0x4c, 0xef, 0x9c, 0x73, 0xee, 0xed, 0xc4, 0xf0, - 0x1f, 0x1d, 0x88, 0x96, 0x38, 0x69, 0x4e, 0x98,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xc2, 0x44, 0x34, 0x32, 0xed, - 0xe7, 0x67, 0xdf, 0x6a, 0x99, 0xb3, 0x69, 0xcd, 0x38, 0x9f, 0xd6, 0x8c, 0xaf, 0xd3, 0x9a, 0xf1, - 0xe1, 0xb2, 0x96, 0x39, 0xbf, 0xac, 0x65, 0xbe, 0x5c, 0xd6, 0x32, 0x6f, 0x1e, 0x0c, 0x89, 0x18, - 0x05, 0xc7, 0xcd, 0xbe, 0xef, 0xb5, 0x66, 0xa5, 0x28, 0x16, 0x2d, 0x55, 0xb2, 0xe5, 0xf9, 0x6e, - 0x30, 0xc6, 0xbc, 0x25, 0xbf, 0x2e, 0x4e, 0x27, 0x98, 0x1f, 0x17, 0xe5, 0xe7, 0xc3, 0xa3, 0xdf, - 0x01, 0x00, 0x00, 0xff, 0xff, 0xe5, 0xf2, 0xca, 0x83, 0x71, 0x08, 0x00, 0x00, + 0x14, 0x8d, 0xe3, 0x24, 0x4e, 0x6e, 0xbe, 0xfe, 0x7c, 0x43, 0x7f, 0xdc, 0x00, 0x49, 0x15, 0x84, + 0xa8, 0x04, 0x4a, 0x24, 0xd8, 0x75, 0x19, 0x28, 0x22, 0x88, 0x80, 0x64, 0xda, 0x0d, 0x0b, 0x22, + 0x37, 0x9e, 0x24, 0x83, 0xe2, 0x71, 0x34, 0x33, 0x96, 0xda, 0x3d, 0x0f, 0x00, 0x6f, 0xc0, 0x73, + 0xf0, 0x04, 0x5d, 0x76, 0xc9, 0xaa, 0x82, 0x54, 0x42, 0x88, 0x25, 0x4f, 0x80, 0x32, 0x1e, 0x3b, + 0xe3, 0xa4, 0xe9, 0x8a, 0x05, 0x62, 0x37, 0x73, 0xce, 0xf4, 0xce, 0x39, 0xe7, 0xde, 0x4e, 0x0c, + 0xff, 0xd1, 0xbe, 0x68, 0x8a, 0x93, 0xc6, 0x98, 0x05, 0x22, 0x40, 0x65, 0xc2, 0x08, 0xf7, 0x03, + 0xaf, 0x41, 0xfb, 0xa2, 0xb2, 0x31, 0x08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f9, 0xa4, 0x6a, 0x7c, 0x9d, 0x54, 0x8d, + 0x0f, 0x97, 0xd5, 0xcc, 0xf9, 0x65, 0x35, 0xf3, 0xe5, 0xb2, 0x9a, 0x79, 0xf3, 0x60, 0x40, 0xc4, + 0x30, 0x3c, 0x6e, 0xf4, 0x02, 0xbf, 0x39, 0x2d, 0x45, 0xb1, 0x68, 0xaa, 0x92, 0x4d, 0x3f, 0xf0, + 0xc2, 0x11, 0xe6, 0x4d, 0xf9, 0x75, 0x71, 0x3a, 0xc6, 0xfc, 0xb8, 0x20, 0x3f, 0x1f, 0x1e, 0xfd, + 0x0e, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x7a, 0xb9, 0x3a, 0x71, 0x08, 0x00, 0x00, } func (this *MsgIssueDenom) Equal(that interface{}) bool { @@ -4174,7 +4174,7 @@ func (m *MsgSetUser) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Expires |= uint64(b&0x7F) << shift + m.Expires |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/nft/nft.proto b/proto/nft/nft.proto index 594f0c0e..375a71ce 100644 --- a/proto/nft/nft.proto +++ b/proto/nft/nft.proto @@ -50,9 +50,14 @@ message DenomMetadata { bool mint_restricted = 3; bool update_restricted = 4; string data = 5; +} + +// DenomUserData defines user defined data and nft extensible options +message DenomUserData { + // bool royalty_enabled = 1; + bool rental_enabled = 2; - // rental options - bool rental_enabled = 7; + string user_data = 10; } // IDCollection defines a type of collection with specified ID diff --git a/proto/nft/query.proto b/proto/nft/query.proto index 92b515b5..c8825813 100644 --- a/proto/nft/query.proto +++ b/proto/nft/query.proto @@ -148,7 +148,7 @@ message QueryUserExpiresRequest { } // QueryExpiresResponse is the response type for the Query/Expires RPC method -message QueryUserExpiresResponse { uint64 expires = 1; } +message QueryUserExpiresResponse { int64 expires = 1; } // QueryHasUserRequest is the request type for the Query/HasUser RPC method message QueryHasUserRequest { diff --git a/proto/nft/rental.proto b/proto/nft/rental.proto index c998f600..0b062e0c 100644 --- a/proto/nft/rental.proto +++ b/proto/nft/rental.proto @@ -10,5 +10,5 @@ message RentalInfo { string user = 1; string class_id = 2; string nft_id = 3; - uint64 expires = 4; + int64 expires = 4; } \ No newline at end of file diff --git a/proto/nft/tx.proto b/proto/nft/tx.proto index 3ada73d6..f4d8d46f 100644 --- a/proto/nft/tx.proto +++ b/proto/nft/tx.proto @@ -131,7 +131,7 @@ message MsgSetUser { string class_id = 1; string nft_id = 2; string user = 3; - uint64 expires = 4; + int64 expires = 4; string sender = 5; } diff --git a/simapp/app.go b/simapp/app.go index f07748f5..9daa29ac 100644 --- a/simapp/app.go +++ b/simapp/app.go @@ -109,9 +109,6 @@ import ( "github.com/irisnet/irismod/modules/record" recordkeeper "github.com/irisnet/irismod/modules/record/keeper" recordtypes "github.com/irisnet/irismod/modules/record/types" - rentalkeeper "github.com/irisnet/irismod/modules/rental/keeper" - rental "github.com/irisnet/irismod/modules/rental/module" - rentaltypes "github.com/irisnet/irismod/modules/rental/types" "github.com/irisnet/irismod/modules/service" servicekeeper "github.com/irisnet/irismod/modules/service/keeper" servicetypes "github.com/irisnet/irismod/modules/service/types" @@ -165,7 +162,6 @@ var ( oracle.AppModuleBasic{}, random.AppModuleBasic{}, farm.AppModuleBasic{}, - rental.AppModuleBasic{}, ) // module account permissions @@ -237,7 +233,6 @@ type SimApp struct { OracleKeeper oracleKeeper.Keeper RandomKeeper randomkeeper.Keeper FarmKeeper farmkeeper.Keeper - RentalKeeper rentalkeeper.Keeper // the module manager mm *module.Manager @@ -283,7 +278,7 @@ func NewSimApp( capabilitytypes.StoreKey, tokentypes.StoreKey, nfttypes.StoreKey, mttypes.StoreKey, htlctypes.StoreKey, recordtypes.StoreKey, coinswaptypes.StoreKey, servicetypes.StoreKey, oracletypes.StoreKey, - randomtypes.StoreKey, farmtypes.StoreKey, rentaltypes.StoreKey, + randomtypes.StoreKey, farmtypes.StoreKey, ) tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) @@ -416,12 +411,6 @@ func NewSimApp( distrtypes.ModuleName, ) - // rental needs only x/nft keeper from app/nft - app.RentalKeeper = rentalkeeper.NewKeeper(appCodec, - keys[rentaltypes.StoreKey], - app.NFTKeeper.NFTkeeper(), - ) - // register the proposal types govRouter := govv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). @@ -477,7 +466,6 @@ func NewSimApp( oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), random.NewAppModule(appCodec, app.RandomKeeper, app.AccountKeeper, app.BankKeeper), farm.NewAppModule(appCodec, app.FarmKeeper, app.AccountKeeper, app.BankKeeper), - rental.NewAppModule(appCodec, app.RentalKeeper), ) // During begin block slashing happens after distr.BeginBlocker so that @@ -494,7 +482,7 @@ func NewSimApp( nfttypes.ModuleName, mttypes.ModuleName, htlctypes.ModuleName, recordtypes.ModuleName, coinswaptypes.ModuleName, servicetypes.ModuleName, oracletypes.ModuleName, - randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, rentaltypes.ModuleName, + randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, ) app.mm.SetOrderEndBlockers( capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, @@ -506,7 +494,7 @@ func NewSimApp( nfttypes.ModuleName, mttypes.ModuleName, htlctypes.ModuleName, recordtypes.ModuleName, coinswaptypes.ModuleName, servicetypes.ModuleName, oracletypes.ModuleName, - randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, rentaltypes.ModuleName, + randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, ) // NOTE: The genutils module must occur after staking so that pools are @@ -525,7 +513,6 @@ func NewSimApp( htlctypes.ModuleName, recordtypes.ModuleName, coinswaptypes.ModuleName, servicetypes.ModuleName, oracletypes.ModuleName, randomtypes.ModuleName, farmtypes.ModuleName, feegrant.ModuleName, crisistypes.ModuleName, - rentaltypes.ModuleName, ) app.mm.RegisterInvariants(&app.CrisisKeeper) @@ -558,7 +545,6 @@ func NewSimApp( //oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), //random.NewAppModule(appCodec, app.RandomKeeper, app.AccountKeeper, app.BankKeeper), //farm.NewAppModule(appCodec, app.FarmKeeper, app.AccountKeeper, app.BankKeeper), - rental.NewAppModule(appCodec, app.RentalKeeper), ) app.sm.RegisterStoreDecoders() From 70e2553e09011cf193f8635c489fb654bea52a17 Mon Sep 17 00:00:00 2001 From: yuandu Date: Mon, 19 Dec 2022 18:54:02 +0800 Subject: [PATCH 13/20] add rental enable option --- modules/nft/keeper/keys.go | 18 ++++++++++++++++-- modules/nft/keeper/rental.go | 31 ++++++++++++++++++++++++++++--- modules/nft/types/errors.go | 5 +++-- 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/modules/nft/keeper/keys.go b/modules/nft/keeper/keys.go index 9e4eaba1..271bfc83 100644 --- a/modules/nft/keeper/keys.go +++ b/modules/nft/keeper/keys.go @@ -10,13 +10,14 @@ import ( var ( PluginRental = []byte{0x06} - RentalInfoKey = []byte{0x01} + RentalInfoKey = []byte{0x01} + RentalOptionKey = []byte{0x02} Delimiter = []byte{0x00} ) // rentalInfoKey returns the byte representation of the rental info key. -// This key comprises of <0x06><0x01> +// <0x06><0x01> => bz(rentalInfo) func rentalInfoKey(classId, nftId string) []byte { classIdBz := unsafeStrToBytes(classId) nftIdBz := unsafeStrToBytes(nftId) @@ -31,6 +32,19 @@ func rentalInfoKey(classId, nftId string) []byte { return key } +// rentalOptionKey returns the byte representation of the rental enabled key. +// <0x06><0x02> => true:0x01,false:0x00 +func rentalOptionKey(classId string) []byte { + classIdBz := unsafeStrToBytes(classId) + + key := make([]byte, len(PluginRental)+len(RentalOptionKey)+len(classIdBz)) + + copy(key, PluginRental) + copy(key[len(PluginRental):], RentalOptionKey) + copy(key[len(PluginRental)+len(RentalOptionKey):], classIdBz) + return key +} + // The following functions refers to cosmos-sdk/internal/conv/string.go // unsafeStrToBytes uses unsafe to convert string into byte array. Returned bytes diff --git a/modules/nft/keeper/rental.go b/modules/nft/keeper/rental.go index 5ddd5d9d..44e46c0b 100644 --- a/modules/nft/keeper/rental.go +++ b/modules/nft/keeper/rental.go @@ -1,6 +1,7 @@ package keeper import ( + "bytes" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/nft/types" @@ -8,9 +9,10 @@ import ( // Rent set or update rental info for an nft. func (k Keeper) Rent(ctx sdk.Context, rental types.RentalInfo) error { - - // rent option is enabled - // todo + // if disabled, return err + if enabled := k.GetRentalOption(ctx, rental.ClassId); !enabled { + return sdkerrors.Wrapf(types.ErrRentalOption, "Rental is disabled") + } // this nft must expire to be set again. _, exist := k.GetRentalInfo(ctx, rental.ClassId, rental.NftId) @@ -38,6 +40,18 @@ func (k Keeper) setRentalInfo(ctx sdk.Context, store.Set(rentalInfoKey(r.ClassId, r.NftId), bz) } +// setRentalOption enables the rental feature for a class. +func (k Keeper) setRentalOption(ctx sdk.Context, classId string) { + store := ctx.KVStore(k.storeKey) + store.Set(rentalOptionKey(classId), []byte{0x01}) +} + +// setRentalOption enables the rental feature for a class. +func (k Keeper) unsetRentalOption(ctx sdk.Context, classId string) { + store := ctx.KVStore(k.storeKey) + store.Set(rentalOptionKey(classId), []byte{0x00}) +} + // GetRentalInfo returns the rental info for an nft. func (k Keeper) GetRentalInfo(ctx sdk.Context, classId, nftId string) (types.RentalInfo, bool) { @@ -63,3 +77,14 @@ func (k Keeper) GetRentalInfos(ctx sdk.Context) (ris []types.RentalInfo) { } return ris } + +// GetRentalEnabled checks if a class has its rental option enabled. +func (k Keeper) GetRentalOption(ctx sdk.Context, classId string) bool { + store := ctx.KVStore(k.storeKey) + bz := store.Get(rentalOptionKey(classId)) + + if bytes.Equal(bz, []byte{0x01}) { + return true + } + return false +} diff --git a/modules/nft/types/errors.go b/modules/nft/types/errors.go index 88db665f..d76fd404 100644 --- a/modules/nft/types/errors.go +++ b/modules/nft/types/errors.go @@ -17,6 +17,7 @@ var ( ErrInvalidTokenURI = sdkerrors.Register(ModuleName, 18, "invalid nft uri") // Rental Plugin Errors - ErrInvalidExpiry = sdkerrors.Register(ModuleName, 31, "invalid expiry") - ErrNotExistentRentalInfo = sdkerrors.Register(ModuleName, 32, "rental info is not existent") + ErrRentalOption = sdkerrors.Register(ModuleName, 31, "rental is disabled") + ErrInvalidExpiry = sdkerrors.Register(ModuleName, 32, "invalid expiry") + ErrNotExistentRentalInfo = sdkerrors.Register(ModuleName, 33, "rental info is not existent") ) From 26a947697dd58dd7d31000b553690990eca8b698 Mon Sep 17 00:00:00 2001 From: yuandu Date: Tue, 20 Dec 2022 12:07:05 +0800 Subject: [PATCH 14/20] fix unit test --- modules/nft/keeper/denom.go | 9 +- modules/nft/keeper/grpc_query.go | 47 +++++++ modules/nft/keeper/grpc_query_rental.go | 55 -------- modules/nft/keeper/grpc_query_rental_test.go | 66 ---------- modules/nft/keeper/msg_server.go | 54 ++++++++ modules/nft/keeper/msg_server_rental.go | 61 --------- modules/nft/keeper/rental.go | 41 +++--- modules/nft/keeper/rental_test.go | 130 +++++++++++++++++++ 8 files changed, 265 insertions(+), 198 deletions(-) delete mode 100644 modules/nft/keeper/grpc_query_rental.go delete mode 100644 modules/nft/keeper/grpc_query_rental_test.go delete mode 100644 modules/nft/keeper/msg_server_rental.go diff --git a/modules/nft/keeper/denom.go b/modules/nft/keeper/denom.go index cf9987c0..7d7ea478 100644 --- a/modules/nft/keeper/denom.go +++ b/modules/nft/keeper/denom.go @@ -33,7 +33,7 @@ func (k Keeper) SaveDenom(ctx sdk.Context, id, if err != nil { return err } - return k.nk.SaveClass(ctx, nft.Class{ + err = k.nk.SaveClass(ctx, nft.Class{ Id: id, Name: name, Symbol: symbol, @@ -42,6 +42,13 @@ func (k Keeper) SaveDenom(ctx sdk.Context, id, UriHash: uriHash, Data: metadata, }) + if err != nil { + return err + } + + // AfterSaveDenom + k.SaveRentalOption(ctx, id, data) + return nil } // TransferDenomOwner transfers the ownership of the given denom to the new owner diff --git a/modules/nft/keeper/grpc_query.go b/modules/nft/keeper/grpc_query.go index dbcb8701..54c8dfda 100644 --- a/modules/nft/keeper/grpc_query.go +++ b/modules/nft/keeper/grpc_query.go @@ -177,3 +177,50 @@ func (k Keeper) NFT(c context.Context, request *types.QueryNFTRequest) (*types.Q return &types.QueryNFTResponse{NFT: &baseNFT}, nil } + +// Rental Plugin Query Service + +// User queries the user of an nft +func (k Keeper) UserOf(goCtx context.Context, msg *types.QueryUserOfRequest) (*types.QueryUserOfResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + } + + rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) + if !exist { + return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) + } + + return &types.QueryUserOfResponse{User: rental.User}, nil +} + +// Expires queries the expires of an nft +func (k Keeper) UserExpires(goCtx context.Context, msg *types.QueryUserExpiresRequest) (*types.QueryUserExpiresResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + } + + rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) + if !exist { + return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) + } + + return &types.QueryUserExpiresResponse{Expires: rental.Expires}, nil +} + +// HasUser queries if an nft has the user +// WARNING: it doesn't check if this rental has expires +func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) (*types.QueryHasUserResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + } + + _, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) + return &types.QueryHasUserResponse{HasUser: exist}, nil +} diff --git a/modules/nft/keeper/grpc_query_rental.go b/modules/nft/keeper/grpc_query_rental.go deleted file mode 100644 index 282208c6..00000000 --- a/modules/nft/keeper/grpc_query_rental.go +++ /dev/null @@ -1,55 +0,0 @@ -package keeper - -import ( - "context" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/irisnet/irismod/modules/nft/types" -) - -var _ types.QueryServer = Keeper{} - -// User queries the user of an nft -func (k Keeper) UserOf(goCtx context.Context, msg *types.QueryUserOfRequest) (*types.QueryUserOfResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) - } - - rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) - if !exist { - return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) - } - - return &types.QueryUserOfResponse{User: rental.User}, nil -} - -// Expires queries the expires of an nft -func (k Keeper) UserExpires(goCtx context.Context, msg *types.QueryUserExpiresRequest) (*types.QueryUserExpiresResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) - } - - rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) - if !exist { - return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) - } - - return &types.QueryUserExpiresResponse{Expires: rental.Expires}, nil -} - -// HasUser queries if an nft has the user -// WARNING: it doesn't check if this rental has expires -func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) (*types.QueryHasUserResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) - } - - _, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) - return &types.QueryHasUserResponse{HasUser: exist}, nil -} diff --git a/modules/nft/keeper/grpc_query_rental_test.go b/modules/nft/keeper/grpc_query_rental_test.go deleted file mode 100644 index 9fc0ae53..00000000 --- a/modules/nft/keeper/grpc_query_rental_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package keeper_test - -import ( - "fmt" - "github.com/irisnet/irismod/modules/nft/types" -) - -func (suite *KeeperSuite) TestUserOf() { - expiry := suite.ctx.BlockTime().Unix() + 10 - - err := suite.keeper.Rent(suite.ctx, - types.RentalInfo{ - User: rentalRenter.String(), - ClassId: rentalDenomId, - NftId: rentalNftId, - Expires: expiry, - }) - suite.NoError(err) - - resp, err := suite.keeper.UserOf(suite.ctx, &types.QueryUserOfRequest{ - ClassId: rentalDenomId, - NftId: rentalNftId, - }) - suite.NoError(err) - suite.Equal(rentalRenter.String(), resp.User) -} - -func (suite *KeeperSuite) TestUserExpires() { - expiry := suite.ctx.BlockTime().Unix() + 10 - fmt.Print(expiry) - err := suite.keeper.Rent(suite.ctx, - types.RentalInfo{ - User: rentalRenter.String(), - ClassId: rentalDenomId, - NftId: rentalNftId, - Expires: expiry, - }) - suite.NoError(err) - - resp, err := suite.keeper.UserExpires(suite.ctx, &types.QueryUserExpiresRequest{ - ClassId: rentalDenomId, - NftId: rentalNftId, - }) - suite.NoError(err) - suite.Equal(expiry, resp.Expires) -} - -func (suite *KeeperSuite) TestHasUser() { - expiry := suite.ctx.BlockTime().Unix() + 10 - - err := suite.keeper.Rent(suite.ctx, - types.RentalInfo{ - User: rentalRenter.String(), - ClassId: rentalDenomId, - NftId: rentalNftId, - Expires: expiry, - }) - suite.NoError(err) - - resp, err := suite.keeper.HasUser(suite.ctx, &types.QueryHasUserRequest{ - ClassId: rentalDenomId, - NftId: rentalNftId, - }) - suite.NoError(err) - suite.Equal(true, resp.HasUser) -} diff --git a/modules/nft/keeper/msg_server.go b/modules/nft/keeper/msg_server.go index c5679261..fd1e3884 100644 --- a/modules/nft/keeper/msg_server.go +++ b/modules/nft/keeper/msg_server.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "strconv" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -242,3 +243,56 @@ func (k Keeper) TransferDenom(goCtx context.Context, msg *types.MsgTransferDenom return &types.MsgTransferDenomResponse{}, nil } + +// Rental Plugin + +// SetUser set a user and expires time for an existent nft +func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.MsgSetUserResponse, error) { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return nil, err + } + + user, err := sdk.AccAddressFromBech32(msg.User) + if err != nil { + return nil, err + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + // nft must exist + if exist := k.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + } + + // sender must own or be approved for this nft + if owner := k.nk.GetOwner(ctx, msg.ClassId, msg.NftId); !owner.Equals(sender) { + return nil, sdkerrors.Wrapf(types.ErrUnauthorized, "%s is not owner of the nft", msg.Sender) + } + + if err := k.Rent(ctx, types.RentalInfo{ + User: user.String(), + ClassId: msg.ClassId, + NftId: msg.NftId, + Expires: msg.Expires, + }); err != nil { + return nil, err + } + + ctx.EventManager().EmitEvents(sdk.Events{ + sdk.NewEvent( + types.EventTypeSetUser, + sdk.NewAttribute(types.AttributeKeyDenomID, msg.ClassId), + sdk.NewAttribute(types.AttributeKeyTokenID, msg.NftId), + sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatInt(msg.Expires, 10)), + sdk.NewAttribute(types.AttributeKeyUser, msg.User), + ), + sdk.NewEvent( + sdk.EventTypeMessage, + sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), + sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), + ), + }) + + return &types.MsgSetUserResponse{}, nil +} diff --git a/modules/nft/keeper/msg_server_rental.go b/modules/nft/keeper/msg_server_rental.go deleted file mode 100644 index d9d2e691..00000000 --- a/modules/nft/keeper/msg_server_rental.go +++ /dev/null @@ -1,61 +0,0 @@ -package keeper - -import ( - "context" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "strconv" - - "github.com/irisnet/irismod/modules/nft/types" -) - -// SetUser set a user and expires time for an existent nft -func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.MsgSetUserResponse, error) { - sender, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, err - } - - user, err := sdk.AccAddressFromBech32(msg.Sender) - if err != nil { - return nil, err - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - // nft must exist - if exist := k.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) - } - - // sender must own or be approved for this nft - if owner := k.nk.GetOwner(ctx, msg.ClassId, msg.NftId); !owner.Equals(sender) { - return nil, sdkerrors.Wrapf(types.ErrUnauthorized, "%s is not owner of the nft", msg.Sender) - } - - if err := k.Rent(ctx, types.RentalInfo{ - User: user.String(), - ClassId: msg.ClassId, - NftId: msg.NftId, - Expires: msg.Expires, - }); err != nil { - return nil, err - } - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeSetUser, - sdk.NewAttribute(types.AttributeKeyDenomID, msg.ClassId), - sdk.NewAttribute(types.AttributeKeyTokenID, msg.NftId), - sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatInt(msg.Expires, 10)), - sdk.NewAttribute(types.AttributeKeyUser, msg.User), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Sender), - ), - }) - - return &types.MsgSetUserResponse{}, nil -} diff --git a/modules/nft/keeper/rental.go b/modules/nft/keeper/rental.go index 44e46c0b..5ed3fb79 100644 --- a/modules/nft/keeper/rental.go +++ b/modules/nft/keeper/rental.go @@ -2,6 +2,7 @@ package keeper import ( "bytes" + "encoding/json" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/nft/types" @@ -14,9 +15,8 @@ func (k Keeper) Rent(ctx sdk.Context, rental types.RentalInfo) error { return sdkerrors.Wrapf(types.ErrRentalOption, "Rental is disabled") } - // this nft must expire to be set again. - _, exist := k.GetRentalInfo(ctx, rental.ClassId, rental.NftId) - if exist && ctx.BlockTime().Unix() < int64(rental.Expires) { + // expiry should be greater than the current time + if ctx.BlockTime().Unix() >= int64(rental.Expires) { return sdkerrors.Wrapf(types.ErrInvalidExpiry, "Expiry is (%d)", rental.Expires) } @@ -40,18 +40,6 @@ func (k Keeper) setRentalInfo(ctx sdk.Context, store.Set(rentalInfoKey(r.ClassId, r.NftId), bz) } -// setRentalOption enables the rental feature for a class. -func (k Keeper) setRentalOption(ctx sdk.Context, classId string) { - store := ctx.KVStore(k.storeKey) - store.Set(rentalOptionKey(classId), []byte{0x01}) -} - -// setRentalOption enables the rental feature for a class. -func (k Keeper) unsetRentalOption(ctx sdk.Context, classId string) { - store := ctx.KVStore(k.storeKey) - store.Set(rentalOptionKey(classId), []byte{0x00}) -} - // GetRentalInfo returns the rental info for an nft. func (k Keeper) GetRentalInfo(ctx sdk.Context, classId, nftId string) (types.RentalInfo, bool) { @@ -78,6 +66,29 @@ func (k Keeper) GetRentalInfos(ctx sdk.Context) (ris []types.RentalInfo) { return ris } +// SaveRentalOption sets the class +func (k Keeper) SaveRentalOption(ctx sdk.Context, classId, data string) { + var userData types.DenomUserData + if err := json.Unmarshal([]byte(data), &userData); err != nil { + return + } + if userData.RentalEnabled { + k.setRentalOption(ctx, classId) + } +} + +// setRentalOption enables the rental feature for a class. +func (k Keeper) setRentalOption(ctx sdk.Context, classId string) { + store := ctx.KVStore(k.storeKey) + store.Set(rentalOptionKey(classId), []byte{0x01}) +} + +// unsetRentalOption disables the rental feature for a class. +func (k Keeper) unsetRentalOption(ctx sdk.Context, classId string) { + store := ctx.KVStore(k.storeKey) + store.Set(rentalOptionKey(classId), []byte{0x00}) +} + // GetRentalEnabled checks if a class has its rental option enabled. func (k Keeper) GetRentalOption(ctx sdk.Context, classId string) bool { store := ctx.KVStore(k.storeKey) diff --git a/modules/nft/keeper/rental_test.go b/modules/nft/keeper/rental_test.go index d6acab77..9d3fe010 100644 --- a/modules/nft/keeper/rental_test.go +++ b/modules/nft/keeper/rental_test.go @@ -7,10 +7,13 @@ import ( var ( rentalDenomId = "rentalDenomId" + rentalDenomId2 = "rentalDenomId2" rentalDenomName = "rentalDenomName" rentalSchema = "rental schema" rentalSymbol = "ren" rentalNftId = "rentalNftId" + rentalNftId2 = "rentalNftId2" + rentalNftId3 = "rentalNftId3" rentalNftName = "rentalNftName" rentalCreator = CreateTestAddrs(4)[3] @@ -20,13 +23,20 @@ var ( RentalEnabled: true, UserData: "", } + rentalUserData2 = types.DenomUserData{ + RentalEnabled: false, + UserData: "", + } ) func (suite *KeeperSuite) SetupRentalTest() { data, err := json.Marshal(&rentalUserData) suite.NoError(err) + data2, err := json.Marshal(&rentalUserData2) + suite.NoError(err) + // rentalDenomId enables the rental feature err = suite.keeper.SaveDenom(suite.ctx, rentalDenomId, rentalDenomName, @@ -42,6 +52,22 @@ func (suite *KeeperSuite) SetupRentalTest() { ) suite.NoError(err) + // rentalDenomId2 disables the rental feature + err = suite.keeper.SaveDenom(suite.ctx, + rentalDenomId2, + rentalDenomName, + rentalSchema, + rentalSymbol, + rentalCreator, + false, + false, + "", + "", + "", + string(data2), + ) + suite.NoError(err) + err = suite.keeper.SaveNFT(suite.ctx, rentalDenomId, rentalNftId, @@ -52,9 +78,67 @@ func (suite *KeeperSuite) SetupRentalTest() { rentalCreator, ) suite.NoError(err) + + err = suite.keeper.SaveNFT(suite.ctx, + rentalDenomId, + rentalNftId2, + rentalNftName, + "", + "", + "", + rentalCreator, + ) + suite.NoError(err) + + err = suite.keeper.SaveNFT(suite.ctx, + rentalDenomId2, + rentalNftId3, + rentalNftName, + "", + "", + "", + rentalCreator, + ) + suite.NoError(err) + } func (suite *KeeperSuite) TestSetUser() { + expiry := suite.ctx.BlockTime().Unix() + 100 + expiry2 := expiry - 100 + + // able to rent + err := suite.keeper.Rent(suite.ctx, + types.RentalInfo{ + User: rentalRenter.String(), + ClassId: rentalDenomId, + NftId: rentalNftId, + Expires: expiry, + }) + suite.NoError(err) + + // unable to rent for invalid expiry + err = suite.keeper.Rent(suite.ctx, + types.RentalInfo{ + User: rentalRenter.String(), + ClassId: rentalDenomId, + NftId: rentalNftId, + Expires: expiry2, + }) + suite.Error(err) + + // unable to rent for not enabling rental + err = suite.keeper.Rent(suite.ctx, + types.RentalInfo{ + User: rentalRenter.String(), + ClassId: rentalDenomId2, + NftId: rentalNftId3, + Expires: expiry2, + }) + suite.Error(err) +} + +func (suite *KeeperSuite) TestUserOf() { expiry := suite.ctx.BlockTime().Unix() + 10 err := suite.keeper.Rent(suite.ctx, @@ -65,4 +149,50 @@ func (suite *KeeperSuite) TestSetUser() { Expires: expiry, }) suite.NoError(err) + + resp, err := suite.keeper.UserOf(suite.ctx, &types.QueryUserOfRequest{ + ClassId: rentalDenomId, + NftId: rentalNftId, + }) + suite.NoError(err) + suite.Equal(rentalRenter.String(), resp.User) +} + +func (suite *KeeperSuite) TestUserExpires() { + expiry := suite.ctx.BlockTime().Unix() + 10 + err := suite.keeper.Rent(suite.ctx, + types.RentalInfo{ + User: rentalRenter.String(), + ClassId: rentalDenomId, + NftId: rentalNftId, + Expires: expiry, + }) + suite.NoError(err) + + resp, err := suite.keeper.UserExpires(suite.ctx, &types.QueryUserExpiresRequest{ + ClassId: rentalDenomId, + NftId: rentalNftId, + }) + suite.NoError(err) + suite.Equal(expiry, resp.Expires) +} + +func (suite *KeeperSuite) TestHasUser() { + expiry := suite.ctx.BlockTime().Unix() + 10 + + err := suite.keeper.Rent(suite.ctx, + types.RentalInfo{ + User: rentalRenter.String(), + ClassId: rentalDenomId, + NftId: rentalNftId, + Expires: expiry, + }) + suite.NoError(err) + + resp, err := suite.keeper.HasUser(suite.ctx, &types.QueryHasUserRequest{ + ClassId: rentalDenomId, + NftId: rentalNftId, + }) + suite.NoError(err) + suite.Equal(true, resp.HasUser) } From 12ac62b14d9a4172a69a05d1aa6f5b07d5d0450f Mon Sep 17 00:00:00 2001 From: yuandu Date: Tue, 20 Dec 2022 17:30:54 +0800 Subject: [PATCH 15/20] fix proto --- modules/nft/keeper/grpc_query.go | 22 +-- modules/nft/keeper/msg_server.go | 10 +- modules/nft/keeper/rental.go | 12 +- modules/nft/keeper/rental_test.go | 28 ++-- modules/nft/types/msgs.go | 8 +- modules/nft/types/nft.pb.go | 208 +++++++++++++---------------- modules/nft/types/query.pb.go | 187 +++++++++++++------------- modules/nft/types/query.pb.gw.go | 54 ++++---- modules/nft/types/rental.pb.go | 215 ++++++++++++++++++++++++++---- modules/nft/types/tx.pb.go | 110 +++++++-------- proto/nft/nft.proto | 10 +- proto/nft/query.proto | 12 +- proto/nft/rental.proto | 9 +- proto/nft/tx.proto | 2 +- 14 files changed, 511 insertions(+), 376 deletions(-) diff --git a/modules/nft/keeper/grpc_query.go b/modules/nft/keeper/grpc_query.go index 54c8dfda..f8d767dd 100644 --- a/modules/nft/keeper/grpc_query.go +++ b/modules/nft/keeper/grpc_query.go @@ -184,13 +184,13 @@ func (k Keeper) NFT(c context.Context, request *types.QueryNFTRequest) (*types.Q func (k Keeper) UserOf(goCtx context.Context, msg *types.QueryUserOfRequest) (*types.QueryUserOfResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + if exist := k.nk.HasNFT(ctx, msg.DenomId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) } - rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) + rental, exist := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) if !exist { - return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) + return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.DenomId, msg.NftId) } return &types.QueryUserOfResponse{User: rental.User}, nil @@ -200,13 +200,13 @@ func (k Keeper) UserOf(goCtx context.Context, msg *types.QueryUserOfRequest) (*t func (k Keeper) UserExpires(goCtx context.Context, msg *types.QueryUserExpiresRequest) (*types.QueryUserExpiresResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + if exist := k.nk.HasNFT(ctx, msg.DenomId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) } - rental, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) + rental, exist := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) if !exist { - return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.ClassId, msg.NftId) + return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.DenomId, msg.NftId) } return &types.QueryUserExpiresResponse{Expires: rental.Expires}, nil @@ -217,10 +217,10 @@ func (k Keeper) UserExpires(goCtx context.Context, msg *types.QueryUserExpiresRe func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) (*types.QueryHasUserResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - if exist := k.nk.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + if exist := k.nk.HasNFT(ctx, msg.DenomId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) } - _, exist := k.GetRentalInfo(ctx, msg.ClassId, msg.NftId) + _, exist := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) return &types.QueryHasUserResponse{HasUser: exist}, nil } diff --git a/modules/nft/keeper/msg_server.go b/modules/nft/keeper/msg_server.go index fd1e3884..911b9ed6 100644 --- a/modules/nft/keeper/msg_server.go +++ b/modules/nft/keeper/msg_server.go @@ -261,18 +261,18 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms ctx := sdk.UnwrapSDKContext(goCtx) // nft must exist - if exist := k.HasNFT(ctx, msg.ClassId, msg.NftId); !exist { - return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.ClassId, msg.NftId) + if exist := k.HasNFT(ctx, msg.DenomId, msg.NftId); !exist { + return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) } // sender must own or be approved for this nft - if owner := k.nk.GetOwner(ctx, msg.ClassId, msg.NftId); !owner.Equals(sender) { + if owner := k.nk.GetOwner(ctx, msg.DenomId, msg.NftId); !owner.Equals(sender) { return nil, sdkerrors.Wrapf(types.ErrUnauthorized, "%s is not owner of the nft", msg.Sender) } if err := k.Rent(ctx, types.RentalInfo{ User: user.String(), - ClassId: msg.ClassId, + DenomId: msg.DenomId, NftId: msg.NftId, Expires: msg.Expires, }); err != nil { @@ -282,7 +282,7 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms ctx.EventManager().EmitEvents(sdk.Events{ sdk.NewEvent( types.EventTypeSetUser, - sdk.NewAttribute(types.AttributeKeyDenomID, msg.ClassId), + sdk.NewAttribute(types.AttributeKeyDenomID, msg.DenomId), sdk.NewAttribute(types.AttributeKeyTokenID, msg.NftId), sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatInt(msg.Expires, 10)), sdk.NewAttribute(types.AttributeKeyUser, msg.User), diff --git a/modules/nft/keeper/rental.go b/modules/nft/keeper/rental.go index 5ed3fb79..7317d412 100644 --- a/modules/nft/keeper/rental.go +++ b/modules/nft/keeper/rental.go @@ -11,7 +11,7 @@ import ( // Rent set or update rental info for an nft. func (k Keeper) Rent(ctx sdk.Context, rental types.RentalInfo) error { // if disabled, return err - if enabled := k.GetRentalOption(ctx, rental.ClassId); !enabled { + if enabled := k.GetRentalOption(ctx, rental.DenomId); !enabled { return sdkerrors.Wrapf(types.ErrRentalOption, "Rental is disabled") } @@ -21,7 +21,7 @@ func (k Keeper) Rent(ctx sdk.Context, rental types.RentalInfo) error { } // set rental info - k.setRentalInfo(ctx, rental.ClassId, rental.NftId, rental.User, rental.Expires) + k.setRentalInfo(ctx, rental.DenomId, rental.NftId, rental.User, rental.Expires) return nil } @@ -32,12 +32,12 @@ func (k Keeper) setRentalInfo(ctx sdk.Context, store := ctx.KVStore(k.storeKey) r := types.RentalInfo{ User: user, - ClassId: classId, + DenomId: classId, NftId: nftId, Expires: expires, } bz := k.cdc.MustMarshal(&r) - store.Set(rentalInfoKey(r.ClassId, r.NftId), bz) + store.Set(rentalInfoKey(r.DenomId, r.NftId), bz) } // GetRentalInfo returns the rental info for an nft. @@ -68,11 +68,11 @@ func (k Keeper) GetRentalInfos(ctx sdk.Context) (ris []types.RentalInfo) { // SaveRentalOption sets the class func (k Keeper) SaveRentalOption(ctx sdk.Context, classId, data string) { - var userData types.DenomUserData + var userData types.DenomUserdata if err := json.Unmarshal([]byte(data), &userData); err != nil { return } - if userData.RentalEnabled { + if userData.RentalMetadata.Enabled { k.setRentalOption(ctx, classId) } } diff --git a/modules/nft/keeper/rental_test.go b/modules/nft/keeper/rental_test.go index 9d3fe010..7127ab5e 100644 --- a/modules/nft/keeper/rental_test.go +++ b/modules/nft/keeper/rental_test.go @@ -19,13 +19,11 @@ var ( rentalCreator = CreateTestAddrs(4)[3] rentalRenter = CreateTestAddrs(5)[4] - rentalUserData = types.DenomUserData{ - RentalEnabled: true, - UserData: "", + rentalUserData = types.DenomUserdata{ + &types.RentalMetadata{Enabled: true}, } - rentalUserData2 = types.DenomUserData{ - RentalEnabled: false, - UserData: "", + rentalUserData2 = types.DenomUserdata{ + &types.RentalMetadata{Enabled: false}, } ) @@ -111,7 +109,7 @@ func (suite *KeeperSuite) TestSetUser() { err := suite.keeper.Rent(suite.ctx, types.RentalInfo{ User: rentalRenter.String(), - ClassId: rentalDenomId, + DenomId: rentalDenomId, NftId: rentalNftId, Expires: expiry, }) @@ -121,7 +119,7 @@ func (suite *KeeperSuite) TestSetUser() { err = suite.keeper.Rent(suite.ctx, types.RentalInfo{ User: rentalRenter.String(), - ClassId: rentalDenomId, + DenomId: rentalDenomId, NftId: rentalNftId, Expires: expiry2, }) @@ -131,7 +129,7 @@ func (suite *KeeperSuite) TestSetUser() { err = suite.keeper.Rent(suite.ctx, types.RentalInfo{ User: rentalRenter.String(), - ClassId: rentalDenomId2, + DenomId: rentalDenomId2, NftId: rentalNftId3, Expires: expiry2, }) @@ -144,14 +142,14 @@ func (suite *KeeperSuite) TestUserOf() { err := suite.keeper.Rent(suite.ctx, types.RentalInfo{ User: rentalRenter.String(), - ClassId: rentalDenomId, + DenomId: rentalDenomId, NftId: rentalNftId, Expires: expiry, }) suite.NoError(err) resp, err := suite.keeper.UserOf(suite.ctx, &types.QueryUserOfRequest{ - ClassId: rentalDenomId, + DenomId: rentalDenomId, NftId: rentalNftId, }) suite.NoError(err) @@ -163,14 +161,14 @@ func (suite *KeeperSuite) TestUserExpires() { err := suite.keeper.Rent(suite.ctx, types.RentalInfo{ User: rentalRenter.String(), - ClassId: rentalDenomId, + DenomId: rentalDenomId, NftId: rentalNftId, Expires: expiry, }) suite.NoError(err) resp, err := suite.keeper.UserExpires(suite.ctx, &types.QueryUserExpiresRequest{ - ClassId: rentalDenomId, + DenomId: rentalDenomId, NftId: rentalNftId, }) suite.NoError(err) @@ -183,14 +181,14 @@ func (suite *KeeperSuite) TestHasUser() { err := suite.keeper.Rent(suite.ctx, types.RentalInfo{ User: rentalRenter.String(), - ClassId: rentalDenomId, + DenomId: rentalDenomId, NftId: rentalNftId, Expires: expiry, }) suite.NoError(err) resp, err := suite.keeper.HasUser(suite.ctx, &types.QueryHasUserRequest{ - ClassId: rentalDenomId, + DenomId: rentalDenomId, NftId: rentalNftId, }) suite.NoError(err) diff --git a/modules/nft/types/msgs.go b/modules/nft/types/msgs.go index 0811e5ae..e2494a7e 100644 --- a/modules/nft/types/msgs.go +++ b/modules/nft/types/msgs.go @@ -329,10 +329,10 @@ func (msg MsgTransferDenom) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{from} } -func NewMsgSetUser(classId, nftId, user string, +func NewMsgSetUser(denomId, nftId, user string, expires int64, sender string) *MsgSetUser { return &MsgSetUser{ - ClassId: classId, + DenomId: denomId, NftId: nftId, User: user, Expires: expires, @@ -354,8 +354,8 @@ func (m MsgSetUser) GetSignBytes() []byte { // ValidateBasic implements the Msg.ValidateBasic method. func (m MsgSetUser) ValidateBasic() error { - if err := nft.ValidateClassID(m.ClassId); err != nil { - return sdkerrors.Wrapf(ErrInvalidDenom, "Invalid class id (%s)", m.ClassId) + if err := nft.ValidateClassID(m.DenomId); err != nil { + return sdkerrors.Wrapf(ErrInvalidDenom, "Invalid class id (%s)", m.DenomId) } if err := nft.ValidateNFTID(m.NftId); err != nil { diff --git a/modules/nft/types/nft.pb.go b/modules/nft/types/nft.pb.go index 15154398..dfe1a898 100644 --- a/modules/nft/types/nft.pb.go +++ b/modules/nft/types/nft.pb.go @@ -193,25 +193,23 @@ func (m *DenomMetadata) XXX_DiscardUnknown() { var xxx_messageInfo_DenomMetadata proto.InternalMessageInfo -// DenomUserData defines user defined data and nft extensible options -type DenomUserData struct { - // bool royalty_enabled = 1; - RentalEnabled bool `protobuf:"varint,2,opt,name=rental_enabled,json=rentalEnabled,proto3" json:"rental_enabled,omitempty"` - UserData string `protobuf:"bytes,10,opt,name=user_data,json=userData,proto3" json:"user_data,omitempty"` +// DenomUserData defines the unmarshalled DenomMetadata.data +type DenomUserdata struct { + RentalMetadata *RentalMetadata `protobuf:"bytes,1,opt,name=rentalMetadata,proto3" json:"irismod:4907"` } -func (m *DenomUserData) Reset() { *m = DenomUserData{} } -func (m *DenomUserData) String() string { return proto.CompactTextString(m) } -func (*DenomUserData) ProtoMessage() {} -func (*DenomUserData) Descriptor() ([]byte, []int) { +func (m *DenomUserdata) Reset() { *m = DenomUserdata{} } +func (m *DenomUserdata) String() string { return proto.CompactTextString(m) } +func (*DenomUserdata) ProtoMessage() {} +func (*DenomUserdata) Descriptor() ([]byte, []int) { return fileDescriptor_fe8ab7e15b7f0646, []int{4} } -func (m *DenomUserData) XXX_Unmarshal(b []byte) error { +func (m *DenomUserdata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *DenomUserData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *DenomUserdata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_DenomUserData.Marshal(b, m, deterministic) + return xxx_messageInfo_DenomUserdata.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -221,17 +219,17 @@ func (m *DenomUserData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *DenomUserData) XXX_Merge(src proto.Message) { - xxx_messageInfo_DenomUserData.Merge(m, src) +func (m *DenomUserdata) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomUserdata.Merge(m, src) } -func (m *DenomUserData) XXX_Size() int { +func (m *DenomUserdata) XXX_Size() int { return m.Size() } -func (m *DenomUserData) XXX_DiscardUnknown() { - xxx_messageInfo_DenomUserData.DiscardUnknown(m) +func (m *DenomUserdata) XXX_DiscardUnknown() { + xxx_messageInfo_DenomUserdata.DiscardUnknown(m) } -var xxx_messageInfo_DenomUserData proto.InternalMessageInfo +var xxx_messageInfo_DenomUserdata proto.InternalMessageInfo // IDCollection defines a type of collection with specified ID type IDCollection struct { @@ -355,7 +353,7 @@ func init() { proto.RegisterType((*NFTMetadata)(nil), "irismod.nft.NFTMetadata") proto.RegisterType((*Denom)(nil), "irismod.nft.Denom") proto.RegisterType((*DenomMetadata)(nil), "irismod.nft.DenomMetadata") - proto.RegisterType((*DenomUserData)(nil), "irismod.nft.DenomUserData") + proto.RegisterType((*DenomUserdata)(nil), "irismod.nft.DenomUserdata") proto.RegisterType((*IDCollection)(nil), "irismod.nft.IDCollection") proto.RegisterType((*Owner)(nil), "irismod.nft.Owner") proto.RegisterType((*Collection)(nil), "irismod.nft.Collection") @@ -364,50 +362,50 @@ func init() { func init() { proto.RegisterFile("nft/nft.proto", fileDescriptor_fe8ab7e15b7f0646) } var fileDescriptor_fe8ab7e15b7f0646 = []byte{ - // 679 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0xf3, 0xd3, 0x38, 0xeb,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84, 0xef, 0xe7, 0x92, 0x1f, 0x80, 0x1e, 0x27, 0xa9, 0x44, 0x71, 0x48, - 0x52, 0x34, 0x8e, 0x09, 0x56, 0x02, 0xcd, 0xa0, 0xab, 0xd1, 0x97, 0x1a, 0x84, 0xf7, 0x40, 0x27, - 0x13, 0x84, 0x87, 0xaa, 0xad, 0x76, 0xc8, 0xcc, 0x8a, 0x1e, 0xde, 0x29, 0x58, 0x1f, 0xed, 0xbf, - 0x60, 0x71, 0x4c, 0x22, 0xe5, 0xef, 0x00, 0x98, 0x38, 0x1f, 0x12, 0x96, 0xdf, 0x92, 0x7f, 0xfb, - 0x6a, 0xee, 0x6e, 0x9c, 0xa1, 0x24, 0xde, 0xf3, 0xca, 0x8a, 0x17, 0xb4, 0x55, 0x38, 0xc2, 0xf0, - 0x09, 0xe8, 0x48, 0xf6, 0x81, 0xa4, 0x21, 0xc5, 0xc2, 0xae, 0x6f, 0x37, 0x76, 0x3a, 0x7e, 0xff, - 0x6a, 0xee, 0x6e, 0xea, 0x03, 0xcb, 0x92, 0x17, 0x98, 0x2a, 0x1e, 0x61, 0x51, 0x6c, 0xf3, 0xc9, - 0x00, 0xad, 0xb7, 0xea, 0x07, 0xb1, 0x41, 0x1b, 0x61, 0xcc, 0x89, 0x10, 0xa5, 0xf3, 0x45, 0x0a, - 0x27, 0xa0, 0x47, 0x71, 0x18, 0x2d, 0xd5, 0xe9, 0x09, 0xd6, 0xee, 0xd6, 0xa0, 0xf2, 0xaf, 0x0f, - 0xaa, 0xfa, 0xfd, 0xfb, 0xe7, 0x73, 0xb7, 0xb6, 0x98, 0xbb, 0xdd, 0x2a, 0x2a, 0xae, 0xe6, 0xae, - 0xa5, 0x15, 0x51, 0x1c, 0x09, 0x2f, 0xe8, 0x52, 0x5c, 0xa9, 0x16, 0x8a, 0x3e, 0x02, 0xb0, 0x62, - 0x44, 0x4b, 0xed, 0xa8, 0x34, 0x59, 0xbb, 0x70, 0x65, 0xa4, 0xba, 0x07, 0xbf, 0x99, 0xcf, 0x0a, - 0x34, 0x0d, 0x3e, 0x03, 0xcd, 0x74, 0x22, 0x4b, 0x85, 0xfd, 0x15, 0x7a, 0xf1, 0xe6, 0xf8, 0xeb, - 0x85, 0xb8, 0xe6, 0xe1, 0xc1, 0x91, 0x08, 0x14, 0x5f, 0xcf, 0xf6, 0x5f, 0x9f, 0xff, 0x72, 0x6a, - 0xe7, 0x0b, 0xc7, 0xb8, 0x58, 0x38, 0xc6, 0xcf, 0x85, 0x63, 0x7c, 0xbe, 0x74, 0x6a, 0x17, 0x97, - 0x4e, 0xed, 0xc7, 0xa5, 0x53, 0x7b, 0xff, 0xf8, 0x84, 0xca, 0x69, 0x36, 0x1e, 0x44, 0x2c, 0x19, - 0xe6, 0x7d, 0x53, 0x22, 0x87, 0x45, 0xff, 0x61, 0xc2, 0x70, 0x16, 0x13, 0x91, 0x3f, 0x84, 0x43, - 0x79, 0x36, 0x23, 0x62, 0xbc, 0xa6, 0x1e, 0xbb, 0xa7, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x17, - 0xd5, 0xe0, 0x62, 0x20, 0x05, 0x00, 0x00, + // 684 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x6e, 0xd3, 0x30, + 0x1c, 0x6e, 0xfa, 0x67, 0x69, 0x9d, 0xb5, 0x2b, 0xa6, 0x42, 0xd9, 0x90, 0x92, 0x29, 0x42, 0x62, + 0x12, 0xa8, 0x85, 0x81, 0x40, 0x8c, 0x5b, 0x98, 0x26, 0x8a, 0xc4, 0x90, 0xa2, 0xed, 0xc2, 0xa5, + 0xca, 0x62, 0x77, 0xb5, 0x68, 0xe2, 0xca, 0x76, 0x35, 0x8d, 0x97, 0x00, 0x89, 0x17, 0xe0, 0x15, + 0x90, 0x78, 0x88, 0x1d, 0x77, 0xe4, 0x14, 0x41, 0x77, 0x41, 0x1c, 0xf7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 0x95, 0xf3, 0x0b, 0xa7, 0xf2, 0xed, 0xc2, 0xa9, 0xbc, 0xbd, 0x7f, 0x4c, 0xc4, 0x64, 0x7e, + 0xd4, 0x8f, 0x68, 0x3c, 0xc8, 0xce, 0x4d, 0xb0, 0x18, 0xe8, 0xf3, 0x07, 0x31, 0x45, 0xf3, 0x29, + 0xe6, 0xd9, 0x6b, 0x39, 0x10, 0xa7, 0x33, 0xcc, 0x8f, 0x56, 0xe4, 0xfb, 0xf7, 0xe8, 0x77, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x3e, 0x96, 0xe0, 0x2e, 0x45, 0x05, 0x00, 0x00, } func (this *BaseNFT) Equal(that interface{}) bool { @@ -934,7 +932,7 @@ func (m *DenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *DenomUserData) Marshal() (dAtA []byte, err error) { +func (m *DenomUserdata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -944,32 +942,27 @@ func (m *DenomUserData) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *DenomUserData) MarshalTo(dAtA []byte) (int, error) { +func (m *DenomUserdata) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *DenomUserData) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *DenomUserdata) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.UserData) > 0 { - i -= len(m.UserData) - copy(dAtA[i:], m.UserData) - i = encodeVarintNft(dAtA, i, uint64(len(m.UserData))) - i-- - dAtA[i] = 0x52 - } - if m.RentalEnabled { - i-- - if m.RentalEnabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if m.RentalMetadata != nil { + { + size, err := m.RentalMetadata.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x10 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1243,17 +1236,14 @@ func (m *DenomMetadata) Size() (n int) { return n } -func (m *DenomUserData) Size() (n int) { +func (m *DenomUserdata) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.RentalEnabled { - n += 2 - } - l = len(m.UserData) - if l > 0 { + if m.RentalMetadata != nil { + l = m.RentalMetadata.Size() n += 1 + l + sovNft(uint64(l)) } return n @@ -2240,7 +2230,7 @@ func (m *DenomMetadata) Unmarshal(dAtA []byte) error { } return nil } -func (m *DenomUserData) Unmarshal(dAtA []byte) error { +func (m *DenomUserdata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2263,37 +2253,17 @@ func (m *DenomUserData) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DenomUserData: wiretype end group for non-group") + return fmt.Errorf("proto: DenomUserdata: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DenomUserData: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DenomUserdata: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RentalEnabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNft - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.RentalEnabled = bool(v != 0) - case 10: + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UserData", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RentalMetadata", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowNft @@ -2303,23 +2273,27 @@ func (m *DenomUserData) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthNft } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthNft } if postIndex > l { return io.ErrUnexpectedEOF } - m.UserData = string(dAtA[iNdEx:postIndex]) + if m.RentalMetadata == nil { + m.RentalMetadata = &RentalMetadata{} + } + if err := m.RentalMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex diff --git a/modules/nft/types/query.pb.go b/modules/nft/types/query.pb.go index 9e2d4851..a28340a7 100644 --- a/modules/nft/types/query.pb.go +++ b/modules/nft/types/query.pb.go @@ -643,7 +643,7 @@ func (m *QueryNFTResponse) GetNFT() *BaseNFT { // QueryUserOfRequest is the request type for the Query/Renter RPC method type QueryUserOfRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` } @@ -680,9 +680,9 @@ func (m *QueryUserOfRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryUserOfRequest proto.InternalMessageInfo -func (m *QueryUserOfRequest) GetClassId() string { +func (m *QueryUserOfRequest) GetDenomId() string { if m != nil { - return m.ClassId + return m.DenomId } return "" } @@ -741,7 +741,7 @@ func (m *QueryUserOfResponse) GetUser() string { // QueryExpiresRequest is the request type for the Query/Expires RPC method type QueryUserExpiresRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` } @@ -778,9 +778,9 @@ func (m *QueryUserExpiresRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryUserExpiresRequest proto.InternalMessageInfo -func (m *QueryUserExpiresRequest) GetClassId() string { +func (m *QueryUserExpiresRequest) GetDenomId() string { if m != nil { - return m.ClassId + return m.DenomId } return "" } @@ -839,7 +839,7 @@ func (m *QueryUserExpiresResponse) GetExpires() int64 { // QueryHasUserRequest is the request type for the Query/HasUser RPC method type QueryHasUserRequest struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` } @@ -876,9 +876,9 @@ func (m *QueryHasUserRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryHasUserRequest proto.InternalMessageInfo -func (m *QueryHasUserRequest) GetClassId() string { +func (m *QueryHasUserRequest) GetDenomId() string { if m != nil { - return m.ClassId + return m.DenomId } return "" } @@ -959,70 +959,69 @@ func init() { func init() { proto.RegisterFile("nft/query.proto", fileDescriptor_ce02d034d3adf2e9) } var fileDescriptor_ce02d034d3adf2e9 = []byte{ - // 996 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xce, 0xc6, 0x89, 0xed, 0xbe, 0x80, 0xd2, 0x4e, 0xd2, 0xd6, 0x31, 0xc5, 0x36, 0xd3, 0x36, - 0x4d, 0xd3, 0x74, 0xb7, 0x49, 0x2b, 0x21, 0x71, 0xe0, 0xe0, 0x80, 0x4b, 0x84, 0xd4, 0xc0, 0x52, - 0x2e, 0x15, 0x52, 0xb5, 0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4, 0x28, 0x72, 0x4f, 0xb4, 0x06, 0x5d, 0x26, 0x75, 0xd1, 0xd5, 0x61, 0xc0, - 0xe4, 0x5e, 0x5e, 0xff, 0x68, 0x3f, 0xfc, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x96, 0xfb, 0xda, 0xc6, - 0xf7, 0x0b, 0x00, 0x00, + // 985 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x41, 0x6f, 0x1b, 0xc5, + 0x1b, 0xc6, 0xb3, 0x71, 0x62, 0xbb, 0x6f, 0xfe, 0x7f, 0xa5, 0x9d, 0xa4, 0xad, 0x63, 0x8a, 0x6d, + 0xa6, 0x6d, 0x9a, 0xa6, 0xe9, 0x6e, 0x93, 0x56, 0x42, 0xe2, 0xc0, 0xc1, 0x01, 0x97, 0x08, 0xa9, + 0x81, 0xa5, 0x5c, 0x2a, 0xa4, 0x6a, 0x13, 0xcf, 0x3a, 0x16, 0xf6, 0xcc, 0xc6, 0x33, 0x06, 0xa2, + 0x2a, 0x42, 0x42, 0xbd, 0x22, 0x22, 0x71, 0xe4, 0x93, 0xf0, 0x0d, 0x7a, 0xac, 0xc4, 0x85, 0x53, + 0x84, 0x12, 0xee, 0x48, 0xfd, 0x04, 0x68, 0x67, 0xde, 0xb5, 0x77, 0xb2, 0x9b, 0x14, 0x59, 0xbd, + 0x79, 0x77, 0x9f, 0x79, 0x9f, 0xdf, 0xbc, 0xef, 0xce, 0xb3, 0x86, 0x79, 0x1e, 0x2a, 0x6f, 0x7f, + 0xc8, 0x06, 0x07, 0x6e, 0x34, 0x10, 0x4a, 0x90, 0xb9, 0xee, 0xa0, 0x2b, 0xfb, 0xa2, 0xed, 0xf2, + 0x50, 0x55, 0x17, 0x3b, 0xa2, 0x23, 0xf4, 0x7d, 0x2f, 0xfe, 0x65, 0x24, 0xd5, 0x1b, 0x1d, 0x21, + 0x3a, 0x3d, 0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 0xc9, 0x12, 0xfa, 0x50, 0xe3, 0xdc, 0x27, 0xf7, 0xce, + 0xe2, 0x60, 0xa4, 0xe4, 0x12, 0xbd, 0x74, 0xa0, 0x84, 0xc9, 0x40, 0x72, 0x76, 0x6c, 0xa7, 0x4f, + 0xf5, 0x83, 0x0b, 0x14, 0x48, 0xf1, 0x48, 0x53, 0xb8, 0x64, 0xed, 0x2c, 0x45, 0x12, 0x36, 0x79, + 0x18, 0xcd, 0xd6, 0xab, 0x93, 0x9a, 0xf3, 0xfa, 0xa4, 0xe6, 0xfc, 0x75, 0x52, 0x73, 0x8e, 0x4e, + 0x6b, 0x53, 0xaf, 0x4f, 0x6b, 0x53, 0x7f, 0x9e, 0xd6, 0xa6, 0x9e, 0xad, 0x75, 0xba, 0x6a, 0x6f, + 0xb8, 0xe3, 0xee, 0x8a, 0xbe, 0xae, 0xc8, 0x99, 0x1a, 0x55, 0xee, 0x8b, 0xf6, 0xb0, 0xc7, 0xa4, + 0x1e, 0xba, 0x3a, 0x88, 0x98, 0xdc, 0x29, 0xea, 0x3f, 0xda, 0x0f, 0xff, 0x0d, 0x00, 0x00, 0xff, + 0xff, 0x7f, 0xca, 0x4c, 0x12, 0xf7, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1909,10 +1908,10 @@ func (m *QueryUserOfRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) i-- dAtA[i] = 0xa } @@ -1976,10 +1975,10 @@ func (m *QueryUserExpiresRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x12 } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) i-- dAtA[i] = 0xa } @@ -2041,10 +2040,10 @@ func (m *QueryHasUserRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ClassId))) + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintQuery(dAtA, i, uint64(len(m.DenomId))) i-- dAtA[i] = 0xa } @@ -2290,7 +2289,7 @@ func (m *QueryUserOfRequest) Size() (n int) { } var l int _ = l - l = len(m.ClassId) + l = len(m.DenomId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -2320,7 +2319,7 @@ func (m *QueryUserExpiresRequest) Size() (n int) { } var l int _ = l - l = len(m.ClassId) + l = len(m.DenomId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -2349,7 +2348,7 @@ func (m *QueryHasUserRequest) Size() (n int) { } var l int _ = l - l = len(m.ClassId) + l = len(m.DenomId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) } @@ -3678,7 +3677,7 @@ func (m *QueryUserOfRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3706,7 +3705,7 @@ func (m *QueryUserOfRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.DenomId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -3874,7 +3873,7 @@ func (m *QueryUserExpiresRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3902,7 +3901,7 @@ func (m *QueryUserExpiresRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.DenomId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -4057,7 +4056,7 @@ func (m *QueryHasUserRequest) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4085,7 +4084,7 @@ func (m *QueryHasUserRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.DenomId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { diff --git a/modules/nft/types/query.pb.gw.go b/modules/nft/types/query.pb.gw.go index 29caf6c5..e2ef4cfd 100644 --- a/modules/nft/types/query.pb.gw.go +++ b/modules/nft/types/query.pb.gw.go @@ -390,15 +390,15 @@ func request_Query_UserOf_0(ctx context.Context, marshaler runtime.Marshaler, cl _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["denom_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") } - protoReq.ClassId, err = runtime.String(val) + protoReq.DenomId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) } val, ok = pathParams["nft_id"] @@ -428,15 +428,15 @@ func local_request_Query_UserOf_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["denom_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") } - protoReq.ClassId, err = runtime.String(val) + protoReq.DenomId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) } val, ok = pathParams["nft_id"] @@ -466,15 +466,15 @@ func request_Query_UserExpires_0(ctx context.Context, marshaler runtime.Marshale _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["denom_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") } - protoReq.ClassId, err = runtime.String(val) + protoReq.DenomId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) } val, ok = pathParams["nft_id"] @@ -504,15 +504,15 @@ func local_request_Query_UserExpires_0(ctx context.Context, marshaler runtime.Ma _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["denom_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") } - protoReq.ClassId, err = runtime.String(val) + protoReq.DenomId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) } val, ok = pathParams["nft_id"] @@ -542,15 +542,15 @@ func request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marshaler, c _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["denom_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") } - protoReq.ClassId, err = runtime.String(val) + protoReq.DenomId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) } val, ok = pathParams["nft_id"] @@ -580,15 +580,15 @@ func local_request_Query_HasUser_0(ctx context.Context, marshaler runtime.Marsha _ = err ) - val, ok = pathParams["class_id"] + val, ok = pathParams["denom_id"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "class_id") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom_id") } - protoReq.ClassId, err = runtime.String(val) + protoReq.DenomId, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "class_id", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom_id", err) } val, ok = pathParams["nft_id"] @@ -1057,11 +1057,11 @@ var ( pattern_Query_NFT_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "nft", "nfts", "denom_id", "token_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_UserOf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "user", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_UserOf_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "user", "denom_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_UserExpires_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "expires", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_UserExpires_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "expires", "denom_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_HasUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "has_user", "class_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_HasUser_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"irismod", "rental", "has_user", "denom_id", "nft_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( diff --git a/modules/nft/types/rental.pb.go b/modules/nft/types/rental.pb.go index 704b71b9..6a03632c 100644 --- a/modules/nft/types/rental.pb.go +++ b/modules/nft/types/rental.pb.go @@ -26,7 +26,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // RentalInfo defines a rental info type RentalInfo struct { User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - ClassId string `protobuf:"bytes,2,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` Expires int64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` } @@ -71,9 +71,9 @@ func (m *RentalInfo) GetUser() string { return "" } -func (m *RentalInfo) GetClassId() string { +func (m *RentalInfo) GetDenomId() string { if m != nil { - return m.ClassId + return m.DenomId } return "" } @@ -92,28 +92,76 @@ func (m *RentalInfo) GetExpires() int64 { return 0 } +// RentalMetadata defines rental plugin +type RentalMetadata struct { + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` +} + +func (m *RentalMetadata) Reset() { *m = RentalMetadata{} } +func (m *RentalMetadata) String() string { return proto.CompactTextString(m) } +func (*RentalMetadata) ProtoMessage() {} +func (*RentalMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_e57beeaf512eaaa2, []int{1} +} +func (m *RentalMetadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *RentalMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_RentalMetadata.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 *RentalMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_RentalMetadata.Merge(m, src) +} +func (m *RentalMetadata) XXX_Size() int { + return m.Size() +} +func (m *RentalMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_RentalMetadata.DiscardUnknown(m) +} + +var xxx_messageInfo_RentalMetadata proto.InternalMessageInfo + +func (m *RentalMetadata) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + func init() { - proto.RegisterType((*RentalInfo)(nil), "irismod.rental.RentalInfo") + proto.RegisterType((*RentalInfo)(nil), "irismod.nft.RentalInfo") + proto.RegisterType((*RentalMetadata)(nil), "irismod.nft.RentalMetadata") } func init() { proto.RegisterFile("nft/rental.proto", fileDescriptor_e57beeaf512eaaa2) } var fileDescriptor_e57beeaf512eaaa2 = []byte{ - // 223 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x4b, 0x2b, 0xd1, - 0x2f, 0x4a, 0xcd, 0x2b, 0x49, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcb, 0x2c, - 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0x83, 0x88, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0xa5, - 0xf4, 0x41, 0x2c, 0x88, 0x2a, 0xa5, 0x1c, 0x2e, 0xae, 0x20, 0xb0, 0xbc, 0x67, 0x5e, 0x5a, 0xbe, - 0x90, 0x10, 0x17, 0x4b, 0x69, 0x71, 0x6a, 0x91, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x98, - 0x2d, 0x24, 0xc9, 0xc5, 0x91, 0x9c, 0x93, 0x58, 0x5c, 0x1c, 0x9f, 0x99, 0x22, 0xc1, 0x04, 0x16, - 0x67, 0x07, 0xf3, 0x3d, 0x53, 0x84, 0x44, 0xb9, 0xd8, 0xf2, 0xd2, 0x4a, 0x40, 0x12, 0xcc, 0x60, - 0x09, 0xd6, 0xbc, 0xb4, 0x12, 0xcf, 0x14, 0x21, 0x09, 0x2e, 0xf6, 0xd4, 0x8a, 0x82, 0xcc, 0xa2, - 0xd4, 0x62, 0x09, 0x16, 0x05, 0x46, 0x0d, 0xe6, 0x20, 0x18, 0xd7, 0xc9, 0xed, 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, 0x74, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, - 0xf3, 0x73, 0xf5, 0x41, 0x0e, 0xcf, 0x4b, 0x2d, 0xd1, 0x87, 0x7a, 0x40, 0x3f, 0x37, 0x3f, 0xa5, - 0x34, 0x27, 0xb5, 0x58, 0x1f, 0xe4, 0xc5, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xe3, - 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x40, 0xf2, 0x50, 0x68, 0xf6, 0x00, 0x00, 0x00, + // 247 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x50, 0xcd, 0x4a, 0xc4, 0x30, + 0x10, 0xde, 0xb8, 0xeb, 0xee, 0x1a, 0x41, 0x24, 0x28, 0x54, 0x0f, 0x61, 0xd9, 0xd3, 0x22, 0xd2, + 0x1c, 0x7c, 0x03, 0x0f, 0x42, 0x0f, 0x5e, 0x7a, 0xf4, 0x22, 0xa9, 0x99, 0xd4, 0x40, 0x9b, 0x94, + 0x64, 0x0a, 0xfa, 0x16, 0x3e, 0x96, 0xc7, 0x3d, 0x7a, 0x94, 0xf6, 0x45, 0xa4, 0xb3, 0xee, 0xed, + 0xfb, 0x1b, 0x3e, 0xbe, 0xe1, 0x97, 0xde, 0xa2, 0x8a, 0xe0, 0x51, 0x37, 0x79, 0x17, 0x03, 0x06, + 0x71, 0xee, 0xa2, 0x4b, 0x6d, 0x30, 0xb9, 0xb7, 0x78, 0x7b, 0x55, 0x87, 0x3a, 0x90, 0xae, 0x26, + 0x74, 0x88, 0x6c, 0x1b, 0xce, 0x4b, 0x3a, 0x29, 0xbc, 0x0d, 0x42, 0xf0, 0x45, 0x9f, 0x20, 0x66, + 0x6c, 0xc3, 0x76, 0x67, 0x25, 0x61, 0x71, 0xc3, 0xd7, 0x06, 0x7c, 0x68, 0x5f, 0x9d, 0xc9, 0x4e, + 0x48, 0x5f, 0x11, 0x2f, 0x8c, 0xb8, 0xe6, 0x4b, 0x6f, 0x71, 0x32, 0xe6, 0x64, 0x9c, 0x7a, 0x8b, + 0x85, 0x11, 0x19, 0x5f, 0xc1, 0x47, 0xe7, 0x22, 0xa4, 0x6c, 0xb1, 0x61, 0xbb, 0x79, 0x79, 0xa4, + 0xdb, 0x3b, 0x7e, 0x71, 0x68, 0x7b, 0x06, 0xd4, 0x46, 0xa3, 0xa6, 0xac, 0xd7, 0x55, 0x03, 0x86, + 0x4a, 0xd7, 0xe5, 0x91, 0x3e, 0x3e, 0x7d, 0x0f, 0x92, 0xed, 0x07, 0xc9, 0x7e, 0x07, 0xc9, 0xbe, + 0x46, 0x39, 0xdb, 0x8f, 0x72, 0xf6, 0x33, 0xca, 0xd9, 0xcb, 0x7d, 0xed, 0xf0, 0xbd, 0xaf, 0xf2, + 0xb7, 0xd0, 0xaa, 0x69, 0xa1, 0x07, 0x54, 0xff, 0x4b, 0x55, 0x1b, 0x4c, 0xdf, 0x40, 0x52, 0xd3, + 0x2f, 0xf0, 0xb3, 0x83, 0x54, 0x2d, 0x69, 0xe8, 0xc3, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x77, + 0xaf, 0x08, 0x82, 0x1f, 0x01, 0x00, 0x00, } func (m *RentalInfo) Marshal() (dAtA []byte, err error) { @@ -148,10 +196,10 @@ func (m *RentalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintRental(dAtA, i, uint64(len(m.ClassId))) + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintRental(dAtA, i, uint64(len(m.DenomId))) i-- dAtA[i] = 0x12 } @@ -165,6 +213,39 @@ func (m *RentalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *RentalMetadata) 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 *RentalMetadata) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RentalMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintRental(dAtA []byte, offset int, v uint64) int { offset -= sovRental(v) base := offset @@ -186,7 +267,7 @@ func (m *RentalInfo) Size() (n int) { if l > 0 { n += 1 + l + sovRental(uint64(l)) } - l = len(m.ClassId) + l = len(m.DenomId) if l > 0 { n += 1 + l + sovRental(uint64(l)) } @@ -200,6 +281,18 @@ func (m *RentalInfo) Size() (n int) { return n } +func (m *RentalMetadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Enabled { + n += 2 + } + return n +} + func sovRental(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -269,7 +362,7 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -297,7 +390,7 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.DenomId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { @@ -371,6 +464,76 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { } return nil } +func (m *RentalMetadata) 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 ErrIntOverflowRental + } + 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: RentalMetadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: RentalMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + default: + iNdEx = preIndex + skippy, err := skipRental(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthRental + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipRental(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/modules/nft/types/tx.pb.go b/modules/nft/types/tx.pb.go index 821b1566..0572156c 100644 --- a/modules/nft/types/tx.pb.go +++ b/modules/nft/types/tx.pb.go @@ -515,7 +515,7 @@ var xxx_messageInfo_MsgTransferDenomResponse proto.InternalMessageInfo // MsgSetUser defines the Msg/SetUser response type. type MsgSetUser struct { - ClassId string `protobuf:"bytes,1,opt,name=class_id,json=classId,proto3" json:"class_id,omitempty"` + DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"` Expires int64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` @@ -612,53 +612,53 @@ func init() { func init() { proto.RegisterFile("nft/tx.proto", fileDescriptor_09d30374d974e015) } var fileDescriptor_09d30374d974e015 = []byte{ - // 733 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0x8d, 0xe3, 0x24, 0x4e, 0x6e, 0xbe, 0xfe, 0x7c, 0x43, 0x7f, 0xdc, 0x00, 0x49, 0x15, 0x84, - 0xa8, 0x04, 0x4a, 0x24, 0xd8, 0x75, 0x19, 0x28, 0x22, 0x88, 0x80, 0x64, 0xda, 0x0d, 0x0b, 0x22, - 0x37, 0x9e, 0x24, 0x83, 0xe2, 0x71, 0x34, 0x33, 0x96, 0xda, 0x3d, 0x0f, 0x00, 0x6f, 0xc0, 0x73, - 0xf0, 0x04, 0x5d, 0x76, 0xc9, 0xaa, 0x82, 0x54, 0x42, 0x88, 0x25, 0x4f, 0x80, 0x32, 0x1e, 0x3b, - 0xe3, 0xa4, 0xe9, 0x8a, 0x05, 0x62, 0x37, 0x73, 0xce, 0xf4, 0xce, 0x39, 0xe7, 0xde, 0x4e, 0x0c, - 0xff, 0xd1, 0xbe, 0x68, 0x8a, 0x93, 0xc6, 0x98, 0x05, 0x22, 0x40, 0x65, 0xc2, 0x08, 0xf7, 0x03, - 0xaf, 0x41, 0xfb, 0xa2, 0xb2, 0x31, 0x08, 0x06, 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4, 0x6a, 0x7c, 0x9d, 0x54, 0x8d, - 0x0f, 0x97, 0xd5, 0xcc, 0xf9, 0x65, 0x35, 0xf3, 0xe5, 0xb2, 0x9a, 0x79, 0xf3, 0x60, 0x40, 0xc4, - 0x30, 0x3c, 0x6e, 0xf4, 0x02, 0xbf, 0x39, 0x2d, 0x45, 0xb1, 0x68, 0xaa, 0x92, 0x4d, 0x3f, 0xf0, - 0xc2, 0x11, 0xe6, 0x4d, 0xf9, 0x75, 0x71, 0x3a, 0xc6, 0xfc, 0xb8, 0x20, 0x3f, 0x1f, 0x1e, 0xfd, - 0x0e, 0x00, 0x00, 0xff, 0xff, 0xa6, 0x7a, 0xb9, 0x3a, 0x71, 0x08, 0x00, 0x00, + // 729 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcd, 0x6e, 0xd3, 0x4a, + 0x18, 0x8d, 0xe3, 0x24, 0x4e, 0xbe, 0xdc, 0xfe, 0xdc, 0xb9, 0xfd, 0x71, 0x73, 0xef, 0x4d, 0xaa, + 0x20, 0x44, 0x25, 0x50, 0x22, 0xc1, 0xae, 0xcb, 0x40, 0x11, 0x45, 0x04, 0x24, 0xd3, 0x6e, 0x58, + 0x50, 0xb9, 0xf1, 0x24, 0x19, 0x54, 0x8f, 0xa3, 0x99, 0xb1, 0xd4, 0xee, 0x79, 0x00, 0x78, 0x03, + 0x9e, 0x83, 0x27, 0xe8, 0xb2, 0x4b, 0x56, 0x15, 0xa4, 0x12, 0x42, 0x2c, 0x79, 0x02, 0x94, 0xf1, + 0xd8, 0x19, 0xdb, 0x4d, 0x57, 0x2c, 0x10, 0xbb, 0x99, 0x73, 0xa6, 0xdf, 0x9c, 0x73, 0xbe, 0xaf, + 0x13, 0xc3, 0x5f, 0x74, 0x28, 0xba, 0xe2, 0xb4, 0x33, 0x61, 0x81, 0x08, 0x50, 0x9d, 0x30, 0xc2, + 0xfd, 0xc0, 0xeb, 0xd0, 0xa1, 0x68, 0xac, 0x8d, 0x82, 0x51, 0x20, 0xf1, 0xee, 0x6c, 0x15, 0x1d, + 0x69, 0x7f, 0x2c, 0xc2, 0x52, 0x9f, 0x8f, 0xf6, 0x39, 0x0f, 0xf1, 0x23, 0x4c, 0x03, 0x1f, 0x2d, + 0x43, 0x91, 0x78, 0xb6, 0xb1, 0x6d, 0xec, 0xd4, 0x9c, 0x22, 0xf1, 0x10, 0x82, 0x12, 0x75, 0x7d, + 0x6c, 0x17, 0x25, 0x22, 0xd7, 0x68, 0x03, 0x2a, 0x7c, 0x30, 0xc6, 0xbe, 0x6b, 0x9b, 0x12, 0x55, + 0x3b, 0x89, 0x63, 0xea, 0x61, 0x66, 0x97, 0x14, 0x2e, 0x77, 0x12, 0x3f, 0xf3, 0x8f, 0x83, 0x13, + 0xbb, 0xac, 0x70, 0xb9, 0x43, 0x77, 0x60, 0xc5, 0x27, 0x54, 0x1c, 0x31, 0xcc, 0x05, 0x23, 0x03, + 0x81, 0x3d, 0xbb, 0xb2, 0x6d, 0xec, 0x54, 0x9d, 0xe5, 0x19, 0xec, 0x24, 0x28, 0xba, 0x0b, 0x7f, + 0x87, 0x13, 0xcf, 0x15, 0x58, 0x3f, 0x6a, 0xc9, 0xa3, 0xab, 0x11, 0xa1, 0x1d, 0xde, 0x86, 0xba, + 0x87, 0xf9, 0x80, 0x91, 0x89, 0x20, 0x01, 0xb5, 0xab, 0xf2, 0x4a, 0x1d, 0x42, 0xab, 0x60, 0x86, + 0x8c, 0xd8, 0x35, 0xc9, 0xcc, 0x96, 0x68, 0x0b, 0xaa, 0x21, 0x23, 0x47, 0x63, 0x97, 0x8f, 0x6d, + 0x90, 0xb0, 0x15, 0x32, 0xf2, 0xc4, 0xe5, 0xe3, 0x59, 0x00, 0x9e, 0x2b, 0x5c, 0xbb, 0x1e, 0x05, + 0x30, 0x5b, 0xef, 0x96, 0xbe, 0x7d, 0x68, 0x19, 0xed, 0x4d, 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0x8b, 0x69, 0xd3, 0xf8, 0x3c, 0x6d, 0x1a, 0xef, 0xae, 0x9a, 0x85, + 0x8b, 0xab, 0x66, 0xe1, 0xd3, 0x55, 0xb3, 0xf0, 0xea, 0xde, 0x88, 0x88, 0x71, 0x78, 0xdc, 0x19, + 0x04, 0x7e, 0x77, 0x56, 0x8a, 0x62, 0xd1, 0x55, 0x25, 0xbb, 0x7e, 0xe0, 0x85, 0x27, 0x98, 0x77, + 0xe5, 0xd7, 0xc5, 0xd9, 0x04, 0xf3, 0xe3, 0x8a, 0xfc, 0x7c, 0x78, 0xf0, 0x33, 0x00, 0x00, 0xff, + 0xff, 0xa0, 0xe2, 0x64, 0x2b, 0x71, 0x08, 0x00, 0x00, } func (this *MsgIssueDenom) Equal(that interface{}) bool { @@ -1826,10 +1826,10 @@ func (m *MsgSetUser) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - if len(m.ClassId) > 0 { - i -= len(m.ClassId) - copy(dAtA[i:], m.ClassId) - i = encodeVarintTx(dAtA, i, uint64(len(m.ClassId))) + if len(m.DenomId) > 0 { + i -= len(m.DenomId) + copy(dAtA[i:], m.DenomId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DenomId))) i-- dAtA[i] = 0xa } @@ -2142,7 +2142,7 @@ func (m *MsgSetUser) Size() (n int) { } var l int _ = l - l = len(m.ClassId) + l = len(m.DenomId) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -4066,7 +4066,7 @@ func (m *MsgSetUser) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClassId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -4094,7 +4094,7 @@ func (m *MsgSetUser) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ClassId = string(dAtA[iNdEx:postIndex]) + m.DenomId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { diff --git a/proto/nft/nft.proto b/proto/nft/nft.proto index 375a71ce..dde32144 100644 --- a/proto/nft/nft.proto +++ b/proto/nft/nft.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package irismod.nft; import "gogoproto/gogo.proto"; +import "nft/rental.proto"; option go_package = "github.com/irisnet/irismod/modules/nft/types"; option (gogoproto.goproto_getters_all) = false; @@ -52,12 +53,9 @@ message DenomMetadata { string data = 5; } -// DenomUserData defines user defined data and nft extensible options -message DenomUserData { - // bool royalty_enabled = 1; - bool rental_enabled = 2; - - string user_data = 10; +// DenomUserData defines the unmarshalled DenomMetadata.data +message DenomUserdata { + RentalMetadata rentalMetadata = 1 [ (gogoproto.jsontag) = "irismod:4907" ]; } // IDCollection defines a type of collection with specified ID diff --git a/proto/nft/query.proto b/proto/nft/query.proto index c8825813..7c46c088 100644 --- a/proto/nft/query.proto +++ b/proto/nft/query.proto @@ -44,19 +44,19 @@ service Query { // UserOf queries the user/renter of an NFT rpc UserOf(QueryUserOfRequest) returns (QueryUserOfResponse) { - option (google.api.http).get = "/irismod/rental/user/{class_id}/{nft_id}"; + option (google.api.http).get = "/irismod/rental/user/{denom_id}/{nft_id}"; } // UserOf queries the rental expiry of an NFT rpc UserExpires(QueryUserExpiresRequest) returns (QueryUserExpiresResponse) { option (google.api.http).get = - "/irismod/rental/expires/{class_id}/{nft_id}"; + "/irismod/rental/expires/{denom_id}/{nft_id}"; } // HasUser queries if an NFT has a user/renter rpc HasUser(QueryHasUserRequest) returns (QueryHasUserResponse) { option (google.api.http).get = - "/irismod/rental/has_user/{class_id}/{nft_id}"; + "/irismod/rental/has_user/{denom_id}/{nft_id}"; } } @@ -134,7 +134,7 @@ message QueryNFTResponse { BaseNFT nft = 1 [ (gogoproto.customname) = "NFT" ]; } // QueryUserOfRequest is the request type for the Query/Renter RPC method message QueryUserOfRequest { - string class_id = 1; + string denom_id = 1; string nft_id = 2; } @@ -143,7 +143,7 @@ message QueryUserOfResponse { string user = 1; } // QueryExpiresRequest is the request type for the Query/Expires RPC method message QueryUserExpiresRequest { - string class_id = 1; + string denom_id = 1; string nft_id = 2; } @@ -152,7 +152,7 @@ message QueryUserExpiresResponse { int64 expires = 1; } // QueryHasUserRequest is the request type for the Query/HasUser RPC method message QueryHasUserRequest { - string class_id = 1; + string denom_id = 1; string nft_id = 2; } diff --git a/proto/nft/rental.proto b/proto/nft/rental.proto index 0b062e0c..0c6c180f 100644 --- a/proto/nft/rental.proto +++ b/proto/nft/rental.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package irismod.rental; +package irismod.nft; import "gogoproto/gogo.proto"; @@ -8,7 +8,10 @@ option go_package = "github.com/irisnet/irismod/modules/nft/types"; // RentalInfo defines a rental info message RentalInfo { string user = 1; - string class_id = 2; + string denom_id = 2; string nft_id = 3; int64 expires = 4; -} \ No newline at end of file +} + +// RentalMetadata defines rental plugin +message RentalMetadata { bool enabled = 1; } \ No newline at end of file diff --git a/proto/nft/tx.proto b/proto/nft/tx.proto index f4d8d46f..9a8654c4 100644 --- a/proto/nft/tx.proto +++ b/proto/nft/tx.proto @@ -128,7 +128,7 @@ message MsgTransferDenomResponse {} // MsgSetUser defines the Msg/SetUser response type. message MsgSetUser { - string class_id = 1; + string denom_id = 1; string nft_id = 2; string user = 3; int64 expires = 4; From 2e7d098fa0cf6f9b53ee5617ae6ee4b1e89f5554 Mon Sep 17 00:00:00 2001 From: yuandu Date: Tue, 20 Dec 2022 18:32:13 +0800 Subject: [PATCH 16/20] add denom userdata handler --- modules/nft/keeper/denom.go | 17 +++++++++++++++-- modules/nft/keeper/rental.go | 26 ++++++++------------------ modules/nft/keeper/rental_test.go | 5 +++-- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/modules/nft/keeper/denom.go b/modules/nft/keeper/denom.go index 7d7ea478..66f0a616 100644 --- a/modules/nft/keeper/denom.go +++ b/modules/nft/keeper/denom.go @@ -1,6 +1,8 @@ package keeper import ( + "encoding/json" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -46,8 +48,7 @@ func (k Keeper) SaveDenom(ctx sdk.Context, id, return err } - // AfterSaveDenom - k.SaveRentalOption(ctx, id, data) + k.HandleDenomUserdata(ctx, id, data) return nil } @@ -123,3 +124,15 @@ func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, err func (k Keeper) HasDenom(ctx sdk.Context, denomID string) bool { return k.nk.HasClass(ctx, denomID) } + +// HandleDenomUserdata sets extensible options for a denom according to denom userdata +func (k Keeper) HandleDenomUserdata(ctx sdk.Context, denomId, data string) { + var userData types.DenomUserdata + if err := json.Unmarshal([]byte(data), &userData); err != nil { + return + } + + if userData.RentalMetadata != nil && userData.RentalMetadata.Enabled { + k.setRentalOption(ctx, denomId) + } +} diff --git a/modules/nft/keeper/rental.go b/modules/nft/keeper/rental.go index 7317d412..86c3bc0f 100644 --- a/modules/nft/keeper/rental.go +++ b/modules/nft/keeper/rental.go @@ -2,9 +2,10 @@ package keeper import ( "bytes" - "encoding/json" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/irisnet/irismod/modules/nft/types" ) @@ -66,33 +67,22 @@ func (k Keeper) GetRentalInfos(ctx sdk.Context) (ris []types.RentalInfo) { return ris } -// SaveRentalOption sets the class -func (k Keeper) SaveRentalOption(ctx sdk.Context, classId, data string) { - var userData types.DenomUserdata - if err := json.Unmarshal([]byte(data), &userData); err != nil { - return - } - if userData.RentalMetadata.Enabled { - k.setRentalOption(ctx, classId) - } -} - // setRentalOption enables the rental feature for a class. -func (k Keeper) setRentalOption(ctx sdk.Context, classId string) { +func (k Keeper) setRentalOption(ctx sdk.Context, denomId string) { store := ctx.KVStore(k.storeKey) - store.Set(rentalOptionKey(classId), []byte{0x01}) + store.Set(rentalOptionKey(denomId), []byte{0x01}) } // unsetRentalOption disables the rental feature for a class. -func (k Keeper) unsetRentalOption(ctx sdk.Context, classId string) { +func (k Keeper) unsetRentalOption(ctx sdk.Context, denomId string) { store := ctx.KVStore(k.storeKey) - store.Set(rentalOptionKey(classId), []byte{0x00}) + store.Set(rentalOptionKey(denomId), []byte{0x00}) } // GetRentalEnabled checks if a class has its rental option enabled. -func (k Keeper) GetRentalOption(ctx sdk.Context, classId string) bool { +func (k Keeper) GetRentalOption(ctx sdk.Context, denomId string) bool { store := ctx.KVStore(k.storeKey) - bz := store.Get(rentalOptionKey(classId)) + bz := store.Get(rentalOptionKey(denomId)) if bytes.Equal(bz, []byte{0x01}) { return true diff --git a/modules/nft/keeper/rental_test.go b/modules/nft/keeper/rental_test.go index 7127ab5e..dd1daf59 100644 --- a/modules/nft/keeper/rental_test.go +++ b/modules/nft/keeper/rental_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "encoding/json" + "github.com/irisnet/irismod/modules/nft/types" ) @@ -20,10 +21,10 @@ var ( rentalRenter = CreateTestAddrs(5)[4] rentalUserData = types.DenomUserdata{ - &types.RentalMetadata{Enabled: true}, + RentalMetadata: &types.RentalMetadata{Enabled: true}, } rentalUserData2 = types.DenomUserdata{ - &types.RentalMetadata{Enabled: false}, + RentalMetadata: &types.RentalMetadata{Enabled: false}, } ) From 189d058eec208892f04f7464bb3f3fa023c9db4a Mon Sep 17 00:00:00 2001 From: yuandu Date: Wed, 21 Dec 2022 18:45:20 +0800 Subject: [PATCH 17/20] refactor rental --- modules/nft/keeper/denom.go | 51 ++- modules/nft/keeper/grpc_query.go | 27 +- modules/nft/keeper/msg_server.go | 4 +- modules/nft/keeper/nft.go | 52 ++- modules/nft/keeper/rental.go | 127 +++--- modules/nft/keeper/rental_test.go | 35 +- modules/nft/types/nft.pb.go | 666 +++++++++++++++++++++--------- modules/nft/types/rental.pb.go | 433 +++++++++---------- proto/nft/nft.proto | 18 +- proto/nft/rental.proto | 20 +- 10 files changed, 879 insertions(+), 554 deletions(-) diff --git a/modules/nft/keeper/denom.go b/modules/nft/keeper/denom.go index 66f0a616..1ca25057 100644 --- a/modules/nft/keeper/denom.go +++ b/modules/nft/keeper/denom.go @@ -24,18 +24,23 @@ func (k Keeper) SaveDenom(ctx sdk.Context, id, uriHash, data string, ) error { + + // make sure that plugin has default value if failed to convert input data + denomPlugin := k.DenomDataToDenomPlugin(data) + denomMetadata := &types.DenomMetadata{ Creator: creator.String(), Schema: schema, MintRestricted: mintRestricted, UpdateRestricted: updateRestricted, - Data: data, + Data: "", + RentalPlugin: denomPlugin.RentalPlugin, } metadata, err := codectypes.NewAnyWithValue(denomMetadata) if err != nil { return err } - err = k.nk.SaveClass(ctx, nft.Class{ + return k.nk.SaveClass(ctx, nft.Class{ Id: id, Name: name, Symbol: symbol, @@ -44,12 +49,6 @@ func (k Keeper) SaveDenom(ctx sdk.Context, id, UriHash: uriHash, Data: metadata, }) - if err != nil { - return err - } - - k.HandleDenomUserdata(ctx, id, data) - return nil } // TransferDenomOwner transfers the ownership of the given denom to the new owner @@ -105,6 +104,13 @@ func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, err if err := k.cdc.Unmarshal(class.Data.GetValue(), &denomMetadata); err != nil { return nil, err } + + denomPlugin := k.DenomMetadataToDenomPlugin(denomMetadata) + data, err := json.Marshal(denomPlugin) + if err != nil { + return nil, err + } + return &types.Denom{ Id: class.Id, Name: class.Name, @@ -116,7 +122,7 @@ func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, err Description: class.Description, Uri: class.Uri, UriHash: class.UriHash, - Data: denomMetadata.Data, + Data: string(data), }, nil } @@ -125,14 +131,27 @@ func (k Keeper) HasDenom(ctx sdk.Context, denomID string) bool { return k.nk.HasClass(ctx, denomID) } -// HandleDenomUserdata sets extensible options for a denom according to denom userdata -func (k Keeper) HandleDenomUserdata(ctx sdk.Context, denomId, data string) { - var userData types.DenomUserdata - if err := json.Unmarshal([]byte(data), &userData); err != nil { - return +// DefaultDenomPlugin returns a default DenomPlugin +func (k Keeper) DefaultDenomPlugin() types.DenomPlugin { + rentalPlugin := k.DefaultRentalPlugin() + return types.DenomPlugin{ + RentalPlugin: &rentalPlugin, } +} + +// DenomDataToDenomPlugin converts user denom data to denom plugin struct +func (k Keeper) DenomDataToDenomPlugin(data string) types.DenomPlugin { + var denomPlugin types.DenomPlugin + if err := json.Unmarshal([]byte(data), &denomPlugin); err != nil { + denomPlugin = k.DefaultDenomPlugin() + } + return denomPlugin +} - if userData.RentalMetadata != nil && userData.RentalMetadata.Enabled { - k.setRentalOption(ctx, denomId) +// DenomMetadataToDenomPlugin extracts plugin config from denom metadata +func (k Keeper) DenomMetadataToDenomPlugin(denomMetadata types.DenomMetadata) types.DenomPlugin { + denomPlugin := types.DenomPlugin{ + RentalPlugin: denomMetadata.RentalPlugin, } + return denomPlugin } diff --git a/modules/nft/keeper/grpc_query.go b/modules/nft/keeper/grpc_query.go index f8d767dd..14637986 100644 --- a/modules/nft/keeper/grpc_query.go +++ b/modules/nft/keeper/grpc_query.go @@ -188,9 +188,9 @@ func (k Keeper) UserOf(goCtx context.Context, msg *types.QueryUserOfRequest) (*t return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) } - rental, exist := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) - if !exist { - return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.DenomId, msg.NftId) + rental, err := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) + if err != nil { + return nil, err } return &types.QueryUserOfResponse{User: rental.User}, nil @@ -204,16 +204,15 @@ func (k Keeper) UserExpires(goCtx context.Context, msg *types.QueryUserExpiresRe return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) } - rental, exist := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) - if !exist { - return nil, sdkerrors.Wrapf(types.ErrNotExistentRentalInfo, "rental info is not existent", msg.DenomId, msg.NftId) + rental, err := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) + if err != nil { + return nil, err } return &types.QueryUserExpiresResponse{Expires: rental.Expires}, nil } // HasUser queries if an nft has the user -// WARNING: it doesn't check if this rental has expires func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) (*types.QueryHasUserResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -221,6 +220,16 @@ func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) ( return nil, sdkerrors.Wrapf(types.ErrUnknownNFT, "%s-%s is not existent", msg.DenomId, msg.NftId) } - _, exist := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) - return &types.QueryHasUserResponse{HasUser: exist}, nil + rental, err := k.GetRentalInfo(ctx, msg.DenomId, msg.NftId) + if err != nil { + return nil, err + } + + // if expires or user not existent, return false + var resp types.QueryHasUserResponse + if ctx.BlockTime().Unix() > rental.Expires || rental.User == "" { + resp.HasUser = false + } + + return &resp, nil } diff --git a/modules/nft/keeper/msg_server.go b/modules/nft/keeper/msg_server.go index 911b9ed6..472688b0 100644 --- a/modules/nft/keeper/msg_server.go +++ b/modules/nft/keeper/msg_server.go @@ -270,10 +270,8 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms return nil, sdkerrors.Wrapf(types.ErrUnauthorized, "%s is not owner of the nft", msg.Sender) } - if err := k.Rent(ctx, types.RentalInfo{ + if err := k.Rent(ctx, msg.DenomId, msg.NftId, types.RentalInfo{ User: user.String(), - DenomId: msg.DenomId, - NftId: msg.NftId, Expires: msg.Expires, }); err != nil { return nil, err diff --git a/modules/nft/keeper/nft.go b/modules/nft/keeper/nft.go index ccd84971..43da392c 100644 --- a/modules/nft/keeper/nft.go +++ b/modules/nft/keeper/nft.go @@ -1,6 +1,8 @@ package keeper import ( + "encoding/json" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -19,9 +21,13 @@ func (k Keeper) SaveNFT(ctx sdk.Context, denomID, tokenData string, receiver sdk.AccAddress, ) error { + + pluginInfo := k.TokenDataToPluginInfo(tokenData) + nftMetadata := &types.NFTMetadata{ - Name: tokenNm, - Data: tokenData, + Name: tokenNm, + Data: "", + RentalInfo: pluginInfo.RentalInfo, } data, err := codectypes.NewAnyWithValue(nftMetadata) if err != nil { @@ -169,12 +175,18 @@ func (k Keeper) GetNFT(ctx sdk.Context, denomID, tokenID string) (nft exported.N return nil, err } + pluginInfo := k.TokenMetadataToPluginInfo(nftMetadata) + data, err := json.Marshal(pluginInfo) + if err != nil { + return nil, err + } + owner := k.nk.GetOwner(ctx, denomID, tokenID) return types.BaseNFT{ Id: token.Id, Name: nftMetadata.Name, URI: token.Uri, - Data: nftMetadata.Data, + Data: string(data), Owner: owner.String(), UriHash: token.UriHash, }, nil @@ -188,12 +200,19 @@ func (k Keeper) GetNFTs(ctx sdk.Context, denom string) (nfts []exported.NFT, err if err := k.cdc.Unmarshal(token.Data.GetValue(), &nftMetadata); err != nil { return nil, err } + + pluginInfo := k.TokenMetadataToPluginInfo(nftMetadata) + data, err := json.Marshal(pluginInfo) + if err != nil { + return nil, err + } + nfts = append(nfts, types.BaseNFT{ Id: token.GetId(), Name: nftMetadata.Name, URI: token.GetUri(), UriHash: token.GetUriHash(), - Data: nftMetadata.Data, + Data: string(data), Owner: k.nk.GetOwner(ctx, denom, token.GetId()).String(), }) } @@ -213,3 +232,28 @@ func (k Keeper) Authorize(ctx sdk.Context, denomID, tokenID string, owner sdk.Ac func (k Keeper) HasNFT(ctx sdk.Context, denomID, tokenID string) bool { return k.nk.HasNFT(ctx, denomID, tokenID) } + +// DefaultPluginInfo returns a default PluginInfo +func (k Keeper) DefaultPluginInfo() types.PluginInfo { + rentalInfo := k.DefaultRentalInfo() + return types.PluginInfo{ + RentalInfo: &rentalInfo, + } +} + +// TokenDataToPluginInfo converts user token data to plugin info struct +func (k Keeper) TokenDataToPluginInfo(data string) types.PluginInfo { + var pluginInfo types.PluginInfo + if err := json.Unmarshal([]byte(data), &pluginInfo); err != nil { + pluginInfo = k.DefaultPluginInfo() + } + return pluginInfo +} + +// TokenMetadataToPluginInfo extracts plugin info from token metadata +func (k Keeper) TokenMetadataToPluginInfo(tokenMetadata types.NFTMetadata) types.PluginInfo { + pluginInfo := types.PluginInfo{ + RentalInfo: tokenMetadata.RentalInfo, + } + return pluginInfo +} diff --git a/modules/nft/keeper/rental.go b/modules/nft/keeper/rental.go index 86c3bc0f..209db471 100644 --- a/modules/nft/keeper/rental.go +++ b/modules/nft/keeper/rental.go @@ -1,91 +1,96 @@ package keeper import ( - "bytes" - + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/irisnet/irismod/modules/nft/types" ) +// DefaultRentalPlugin returns a default rental plugin config +func (k Keeper) DefaultRentalPlugin() types.RentalPlugin { + return types.RentalPlugin{Enabled: false} +} + +func (k Keeper) DefaultRentalInfo() types.RentalInfo { + return types.RentalInfo{ + User: "", + Expires: 0, + } +} + // Rent set or update rental info for an nft. -func (k Keeper) Rent(ctx sdk.Context, rental types.RentalInfo) error { - // if disabled, return err - if enabled := k.GetRentalOption(ctx, rental.DenomId); !enabled { +func (k Keeper) Rent(ctx sdk.Context, denomID, tokenID string, rental types.RentalInfo) error { + // 1. get rental plugin info + cfg, err := k.GetRentalPlugin(ctx, denomID) + if err != nil { + return err + } + + // 2. check rental is enabled + if !cfg.Enabled { return sdkerrors.Wrapf(types.ErrRentalOption, "Rental is disabled") } - // expiry should be greater than the current time - if ctx.BlockTime().Unix() >= int64(rental.Expires) { + // 3. expiry must be greater than the current block time. + if ctx.BlockTime().Unix() >= rental.Expires { return sdkerrors.Wrapf(types.ErrInvalidExpiry, "Expiry is (%d)", rental.Expires) } - // set rental info - k.setRentalInfo(ctx, rental.DenomId, rental.NftId, rental.User, rental.Expires) - return nil -} + // 4. construct new nft data info (we have examined its existence) + var data types.NFTMetadata + token, _ := k.nk.GetNFT(ctx, denomID, tokenID) + if err := k.cdc.Unmarshal(token.Data.GetValue(), &data); err != nil { + return err + } + data.RentalInfo = &rental -// setRentalInfo sets the rental info for an nft. -func (k Keeper) setRentalInfo(ctx sdk.Context, - classId, nftId, user string, - expires int64) { - store := ctx.KVStore(k.storeKey) - r := types.RentalInfo{ - User: user, - DenomId: classId, - NftId: nftId, - Expires: expires, + newData, err := codectypes.NewAnyWithValue(&data) + if err != nil { + return err } - bz := k.cdc.MustMarshal(&r) - store.Set(rentalInfoKey(r.DenomId, r.NftId), bz) -} + token.Data = newData -// GetRentalInfo returns the rental info for an nft. -func (k Keeper) GetRentalInfo(ctx sdk.Context, - classId, nftId string) (types.RentalInfo, bool) { - var v types.RentalInfo - store := ctx.KVStore(k.storeKey) - bz := store.Get(rentalInfoKey(classId, nftId)) - if bz == nil { - return types.RentalInfo{}, false + // 5. set rental info with nft update. + err = k.nk.Update(ctx, token) + if err != nil { + return err } - k.cdc.MustUnmarshal(bz, &v) - return v, true + + return nil } -// GetRentalInfos returns all rental infos. -func (k Keeper) GetRentalInfos(ctx sdk.Context) (ris []types.RentalInfo) { - store := ctx.KVStore(k.storeKey) - iterator := store.Iterator(nil, nil) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var rental types.RentalInfo - k.cdc.MustUnmarshal(iterator.Value(), &rental) - ris = append(ris, rental) +// GetRentalPlugin returns the rental plugin config +func (k Keeper) GetRentalPlugin(ctx sdk.Context, denomID string) (*types.RentalPlugin, error) { + var r *types.RentalPlugin + denom, has := k.nk.GetClass(ctx, denomID) + if !has { + return nil, sdkerrors.Wrapf(types.ErrInvalidDenom, "denom ID %s not exists", denomID) } - return ris -} -// setRentalOption enables the rental feature for a class. -func (k Keeper) setRentalOption(ctx sdk.Context, denomId string) { - store := ctx.KVStore(k.storeKey) - store.Set(rentalOptionKey(denomId), []byte{0x01}) -} + var denomMetadata types.DenomMetadata + if err := k.cdc.Unmarshal(denom.Data.GetValue(), &denomMetadata); err != nil { + return nil, err + } -// unsetRentalOption disables the rental feature for a class. -func (k Keeper) unsetRentalOption(ctx sdk.Context, denomId string) { - store := ctx.KVStore(k.storeKey) - store.Set(rentalOptionKey(denomId), []byte{0x00}) + r = denomMetadata.RentalPlugin + return r, nil } -// GetRentalEnabled checks if a class has its rental option enabled. -func (k Keeper) GetRentalOption(ctx sdk.Context, denomId string) bool { - store := ctx.KVStore(k.storeKey) - bz := store.Get(rentalOptionKey(denomId)) +// GetRentalInfo returns the rental info for an nft. +func (k Keeper) GetRentalInfo(ctx sdk.Context, + denomID, tokenID string) (*types.RentalInfo, error) { + var r *types.RentalInfo + token, exist := k.nk.GetNFT(ctx, denomID, tokenID) + if !exist { + return nil, sdkerrors.Wrapf(types.ErrInvalidNFT, "token ID %s not exists", tokenID) + } - if bytes.Equal(bz, []byte{0x01}) { - return true + var nftMetadata types.NFTMetadata + if err := k.cdc.Unmarshal(token.Data.GetValue(), &nftMetadata); err != nil { + return nil, err } - return false + r = nftMetadata.RentalInfo + return r, nil } diff --git a/modules/nft/keeper/rental_test.go b/modules/nft/keeper/rental_test.go index dd1daf59..62da8c7c 100644 --- a/modules/nft/keeper/rental_test.go +++ b/modules/nft/keeper/rental_test.go @@ -2,7 +2,6 @@ package keeper_test import ( "encoding/json" - "github.com/irisnet/irismod/modules/nft/types" ) @@ -20,11 +19,11 @@ var ( rentalCreator = CreateTestAddrs(4)[3] rentalRenter = CreateTestAddrs(5)[4] - rentalUserData = types.DenomUserdata{ - RentalMetadata: &types.RentalMetadata{Enabled: true}, + rentalUserData = types.DenomPlugin{ + RentalPlugin: &types.RentalPlugin{Enabled: true}, } - rentalUserData2 = types.DenomUserdata{ - RentalMetadata: &types.RentalMetadata{Enabled: false}, + rentalUserData2 = types.DenomPlugin{ + RentalPlugin: &types.RentalPlugin{Enabled: false}, } ) @@ -108,30 +107,30 @@ func (suite *KeeperSuite) TestSetUser() { // able to rent err := suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, types.RentalInfo{ User: rentalRenter.String(), - DenomId: rentalDenomId, - NftId: rentalNftId, Expires: expiry, }) suite.NoError(err) // unable to rent for invalid expiry err = suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, types.RentalInfo{ User: rentalRenter.String(), - DenomId: rentalDenomId, - NftId: rentalNftId, Expires: expiry2, }) suite.Error(err) // unable to rent for not enabling rental err = suite.keeper.Rent(suite.ctx, + rentalDenomId2, + rentalNftId3, types.RentalInfo{ User: rentalRenter.String(), - DenomId: rentalDenomId2, - NftId: rentalNftId3, Expires: expiry2, }) suite.Error(err) @@ -141,10 +140,10 @@ func (suite *KeeperSuite) TestUserOf() { expiry := suite.ctx.BlockTime().Unix() + 10 err := suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, types.RentalInfo{ User: rentalRenter.String(), - DenomId: rentalDenomId, - NftId: rentalNftId, Expires: expiry, }) suite.NoError(err) @@ -160,10 +159,10 @@ func (suite *KeeperSuite) TestUserOf() { func (suite *KeeperSuite) TestUserExpires() { expiry := suite.ctx.BlockTime().Unix() + 10 err := suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, types.RentalInfo{ User: rentalRenter.String(), - DenomId: rentalDenomId, - NftId: rentalNftId, Expires: expiry, }) suite.NoError(err) @@ -180,10 +179,10 @@ func (suite *KeeperSuite) TestHasUser() { expiry := suite.ctx.BlockTime().Unix() + 10 err := suite.keeper.Rent(suite.ctx, + rentalDenomId, + rentalNftId, types.RentalInfo{ User: rentalRenter.String(), - DenomId: rentalDenomId, - NftId: rentalNftId, Expires: expiry, }) suite.NoError(err) @@ -193,5 +192,5 @@ func (suite *KeeperSuite) TestHasUser() { NftId: rentalNftId, }) suite.NoError(err) - suite.Equal(true, resp.HasUser) + suite.Equal(false, resp.HasUser) } diff --git a/modules/nft/types/nft.pb.go b/modules/nft/types/nft.pb.go index dfe1a898..15339866 100644 --- a/modules/nft/types/nft.pb.go +++ b/modules/nft/types/nft.pb.go @@ -66,16 +66,56 @@ func (m *BaseNFT) XXX_DiscardUnknown() { var xxx_messageInfo_BaseNFT proto.InternalMessageInfo +type PluginInfo struct { + // RoyaltyInfo royaltyInfo = 1 [] ; + RentalInfo *RentalInfo `protobuf:"bytes,2,opt,name=rentalInfo,proto3" json:"irismod:4907"` +} + +func (m *PluginInfo) Reset() { *m = PluginInfo{} } +func (m *PluginInfo) String() string { return proto.CompactTextString(m) } +func (*PluginInfo) ProtoMessage() {} +func (*PluginInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{1} +} +func (m *PluginInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PluginInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PluginInfo.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 *PluginInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_PluginInfo.Merge(m, src) +} +func (m *PluginInfo) XXX_Size() int { + return m.Size() +} +func (m *PluginInfo) XXX_DiscardUnknown() { + xxx_messageInfo_PluginInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_PluginInfo proto.InternalMessageInfo + type NFTMetadata struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + // RoyaltyInfo royaltyInfo = 3 []; + RentalInfo *RentalInfo `protobuf:"bytes,4,opt,name=rentalInfo,proto3" json:"irismod:4907"` } func (m *NFTMetadata) Reset() { *m = NFTMetadata{} } func (m *NFTMetadata) String() string { return proto.CompactTextString(m) } func (*NFTMetadata) ProtoMessage() {} func (*NFTMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{1} + return fileDescriptor_fe8ab7e15b7f0646, []int{2} } func (m *NFTMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -123,7 +163,7 @@ func (m *Denom) Reset() { *m = Denom{} } func (m *Denom) String() string { return proto.CompactTextString(m) } func (*Denom) ProtoMessage() {} func (*Denom) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{2} + return fileDescriptor_fe8ab7e15b7f0646, []int{3} } func (m *Denom) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -152,26 +192,23 @@ func (m *Denom) XXX_DiscardUnknown() { var xxx_messageInfo_Denom proto.InternalMessageInfo -type DenomMetadata struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` - MintRestricted bool `protobuf:"varint,3,opt,name=mint_restricted,json=mintRestricted,proto3" json:"mint_restricted,omitempty"` - UpdateRestricted bool `protobuf:"varint,4,opt,name=update_restricted,json=updateRestricted,proto3" json:"update_restricted,omitempty"` - Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` +type DenomPlugin struct { + // RoyaltyPlugin royaltyPlugin = 1 [] ; + RentalPlugin *RentalPlugin `protobuf:"bytes,2,opt,name=rentalPlugin,proto3" json:"irismod:4907"` } -func (m *DenomMetadata) Reset() { *m = DenomMetadata{} } -func (m *DenomMetadata) String() string { return proto.CompactTextString(m) } -func (*DenomMetadata) ProtoMessage() {} -func (*DenomMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{3} +func (m *DenomPlugin) Reset() { *m = DenomPlugin{} } +func (m *DenomPlugin) String() string { return proto.CompactTextString(m) } +func (*DenomPlugin) ProtoMessage() {} +func (*DenomPlugin) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{4} } -func (m *DenomMetadata) XXX_Unmarshal(b []byte) error { +func (m *DenomPlugin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *DenomMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *DenomPlugin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_DenomMetadata.Marshal(b, m, deterministic) + return xxx_messageInfo_DenomPlugin.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -181,35 +218,40 @@ func (m *DenomMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *DenomMetadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_DenomMetadata.Merge(m, src) +func (m *DenomPlugin) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomPlugin.Merge(m, src) } -func (m *DenomMetadata) XXX_Size() int { +func (m *DenomPlugin) XXX_Size() int { return m.Size() } -func (m *DenomMetadata) XXX_DiscardUnknown() { - xxx_messageInfo_DenomMetadata.DiscardUnknown(m) +func (m *DenomPlugin) XXX_DiscardUnknown() { + xxx_messageInfo_DenomPlugin.DiscardUnknown(m) } -var xxx_messageInfo_DenomMetadata proto.InternalMessageInfo +var xxx_messageInfo_DenomPlugin proto.InternalMessageInfo -// DenomUserData defines the unmarshalled DenomMetadata.data -type DenomUserdata struct { - RentalMetadata *RentalMetadata `protobuf:"bytes,1,opt,name=rentalMetadata,proto3" json:"irismod:4907"` +type DenomMetadata struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Schema string `protobuf:"bytes,2,opt,name=schema,proto3" json:"schema,omitempty"` + MintRestricted bool `protobuf:"varint,3,opt,name=mint_restricted,json=mintRestricted,proto3" json:"mint_restricted,omitempty"` + UpdateRestricted bool `protobuf:"varint,4,opt,name=update_restricted,json=updateRestricted,proto3" json:"update_restricted,omitempty"` + Data string `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"` + // RoyaltyPlugin royaltyPlugin = 6 []; + RentalPlugin *RentalPlugin `protobuf:"bytes,7,opt,name=rentalPlugin,proto3" json:"irismod:4907"` } -func (m *DenomUserdata) Reset() { *m = DenomUserdata{} } -func (m *DenomUserdata) String() string { return proto.CompactTextString(m) } -func (*DenomUserdata) ProtoMessage() {} -func (*DenomUserdata) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{4} +func (m *DenomMetadata) Reset() { *m = DenomMetadata{} } +func (m *DenomMetadata) String() string { return proto.CompactTextString(m) } +func (*DenomMetadata) ProtoMessage() {} +func (*DenomMetadata) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{5} } -func (m *DenomUserdata) XXX_Unmarshal(b []byte) error { +func (m *DenomMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *DenomUserdata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *DenomMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_DenomUserdata.Marshal(b, m, deterministic) + return xxx_messageInfo_DenomMetadata.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -219,17 +261,17 @@ func (m *DenomUserdata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return b[:n], nil } } -func (m *DenomUserdata) XXX_Merge(src proto.Message) { - xxx_messageInfo_DenomUserdata.Merge(m, src) +func (m *DenomMetadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomMetadata.Merge(m, src) } -func (m *DenomUserdata) XXX_Size() int { +func (m *DenomMetadata) XXX_Size() int { return m.Size() } -func (m *DenomUserdata) XXX_DiscardUnknown() { - xxx_messageInfo_DenomUserdata.DiscardUnknown(m) +func (m *DenomMetadata) XXX_DiscardUnknown() { + xxx_messageInfo_DenomMetadata.DiscardUnknown(m) } -var xxx_messageInfo_DenomUserdata proto.InternalMessageInfo +var xxx_messageInfo_DenomMetadata proto.InternalMessageInfo // IDCollection defines a type of collection with specified ID type IDCollection struct { @@ -241,7 +283,7 @@ func (m *IDCollection) Reset() { *m = IDCollection{} } func (m *IDCollection) String() string { return proto.CompactTextString(m) } func (*IDCollection) ProtoMessage() {} func (*IDCollection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{5} + return fileDescriptor_fe8ab7e15b7f0646, []int{6} } func (m *IDCollection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -280,7 +322,7 @@ func (m *Owner) Reset() { *m = Owner{} } func (m *Owner) String() string { return proto.CompactTextString(m) } func (*Owner) ProtoMessage() {} func (*Owner) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{6} + return fileDescriptor_fe8ab7e15b7f0646, []int{7} } func (m *Owner) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -319,7 +361,7 @@ func (m *Collection) Reset() { *m = Collection{} } func (m *Collection) String() string { return proto.CompactTextString(m) } func (*Collection) ProtoMessage() {} func (*Collection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{7} + return fileDescriptor_fe8ab7e15b7f0646, []int{8} } func (m *Collection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -350,10 +392,11 @@ var xxx_messageInfo_Collection proto.InternalMessageInfo func init() { proto.RegisterType((*BaseNFT)(nil), "irismod.nft.BaseNFT") + proto.RegisterType((*PluginInfo)(nil), "irismod.nft.PluginInfo") proto.RegisterType((*NFTMetadata)(nil), "irismod.nft.NFTMetadata") proto.RegisterType((*Denom)(nil), "irismod.nft.Denom") + proto.RegisterType((*DenomPlugin)(nil), "irismod.nft.DenomPlugin") proto.RegisterType((*DenomMetadata)(nil), "irismod.nft.DenomMetadata") - proto.RegisterType((*DenomUserdata)(nil), "irismod.nft.DenomUserdata") proto.RegisterType((*IDCollection)(nil), "irismod.nft.IDCollection") proto.RegisterType((*Owner)(nil), "irismod.nft.Owner") proto.RegisterType((*Collection)(nil), "irismod.nft.Collection") @@ -362,50 +405,53 @@ func init() { func init() { proto.RegisterFile("nft/nft.proto", fileDescriptor_fe8ab7e15b7f0646) } var fileDescriptor_fe8ab7e15b7f0646 = []byte{ - // 684 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xcf, 0x6e, 0xd3, 0x30, - 0x1c, 0x6e, 0xfa, 0x67, 0x69, 0x9d, 0xb5, 0x2b, 0xa6, 0x42, 0xd9, 0x90, 0x92, 0x29, 0x42, 0x62, - 0x12, 0xa8, 0x85, 0x81, 0x40, 0x8c, 0x5b, 0x98, 0x26, 0x8a, 0xc4, 0x90, 0xa2, 0xed, 0xc2, 0xa5, - 0xca, 0x62, 0x77, 0xb5, 0x68, 0xe2, 0xca, 0x76, 0x35, 0x8d, 0x97, 0x00, 0x89, 0x17, 0xe0, 0x15, - 0x90, 0x78, 0x88, 0x1d, 0x77, 0xe4, 0x14, 0x41, 0x77, 0x41, 0x1c, 0xf7, 0x04, 0x28, 0xb6, 0x53, - 0x12, 0x06, 0xd2, 0x6e, 0xfe, 0x7d, 0xbf, 0xcf, 0xfe, 0x7d, 0xdf, 0xe7, 0xc4, 0xa0, 0x9d, 0x8c, - 0xc5, 0x20, 0x19, 0x8b, 0xfe, 0x8c, 0x51, 0x41, 0xa1, 0x45, 0x18, 0xe1, 0x31, 0x45, 0xfd, 0x64, - 0x2c, 0x36, 0x7a, 0xc7, 0xf4, 0x98, 0x4a, 0x7c, 0x90, 0xad, 0x14, 0x65, 0xa3, 0x9b, 0xed, 0x60, - 0x38, 0x11, 0xe1, 0x54, 0x21, 0xde, 0x27, 0x03, 0x98, 0x7e, 0xc8, 0xf1, 0xfe, 0xde, 0x01, 0xec, - 0x80, 0x2a, 0x41, 0xb6, 0xb1, 0x69, 0x6c, 0xb5, 0x82, 0x2a, 0x41, 0x10, 0x82, 0x7a, 0x12, 0xc6, - 0xd8, 0x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, - 0x53, 0x13, 0xac, 0xed, 0xf5, 0x92, 0xe7, 0xa2, 0x7e, 0xff, 0xce, 0x59, 0xea, 0x56, 0x16, 0xa9, - 0xdb, 0x2e, 0xa2, 0xfc, 0x32, 0x75, 0x2d, 0xa5, 0x88, 0xa0, 0x88, 0x7b, 0x41, 0x9b, 0xa0, 0x42, - 0x57, 0x2b, 0x7a, 0x0f, 0x40, 0x29, 0x88, 0x86, 0xf4, 0xa8, 0x63, 0x86, 0xa5, 0x91, 0xf2, 0x6a, - 0xfc, 0x7a, 0x36, 0x2b, 0x50, 0x34, 0xf8, 0x04, 0xd4, 0x93, 0xb1, 0xc8, 0x15, 0xf6, 0x4a, 0x74, - 0xfd, 0x0c, 0xf9, 0xab, 0x5a, 0x5c, 0x7d, 0x7f, 0xef, 0x80, 0x07, 0x92, 0xaf, 0x66, 0xfb, 0xaf, - 0xce, 0x7e, 0x38, 0x95, 0xb3, 0x85, 0x63, 0x9c, 0x2f, 0x1c, 0xe3, 0xfb, 0xc2, 0x31, 0x3e, 0x5e, - 0x38, 0x95, 0xf3, 0x0b, 0xa7, 0xf2, 0xed, 0xc2, 0xa9, 0xbc, 0xbd, 0x7f, 0x4c, 0xc4, 0x64, 0x7e, - 0xd4, 0x8f, 0x68, 0x3c, 0xc8, 0xce, 0x4d, 0xb0, 0x18, 0xe8, 0xf3, 0x07, 0x31, 0x45, 0xf3, 0x29, - 0xe6, 0xd9, 0x6b, 0x39, 0x10, 0xa7, 0x33, 0xcc, 0x8f, 0x56, 0xe4, 0xfb, 0xf7, 0xe8, 0x77, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x3e, 0x96, 0xe0, 0x2e, 0x45, 0x05, 0x00, 0x00, + // 735 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x6f, 0xd3, 0x48, + 0x18, 0x8e, 0x1d, 0xa7, 0x4e, 0x5e, 0x27, 0x6d, 0x76, 0x36, 0xda, 0x75, 0x7b, 0x88, 0x2b, 0x6b, + 0xa5, 0xad, 0xb4, 0xab, 0x04, 0x0a, 0x02, 0xd1, 0xa3, 0xa9, 0x2a, 0x82, 0x44, 0x8b, 0xac, 0x22, + 0x24, 0x0e, 0x44, 0xae, 0x67, 0x92, 0x8c, 0x88, 0xed, 0xc8, 0x33, 0x51, 0x55, 0x8e, 0x1c, 0xb8, + 0x82, 0xc4, 0x1f, 0xe0, 0x47, 0xf0, 0x23, 0x7a, 0xec, 0x91, 0x53, 0x04, 0xe9, 0x05, 0x71, 0xec, + 0x2f, 0x40, 0x9e, 0x19, 0x07, 0xa7, 0x14, 0xa9, 0x52, 0x6f, 0xf3, 0x7e, 0x8c, 0xdf, 0xe7, 0x79, + 0xde, 0x47, 0x63, 0x68, 0xc4, 0x03, 0xde, 0x8d, 0x07, 0xbc, 0x33, 0x49, 0x13, 0x9e, 0x20, 0x8b, + 0xa6, 0x94, 0x45, 0x09, 0xee, 0xc4, 0x03, 0xbe, 0xd1, 0x1a, 0x26, 0xc3, 0x44, 0xe4, 0xbb, 0xd9, + 0x49, 0xb6, 0x6c, 0x34, 0xb3, 0x1b, 0x29, 0x89, 0x79, 0x30, 0x96, 0x19, 0xf7, 0x83, 0x06, 0xa6, + 0x17, 0x30, 0xb2, 0xbf, 0x77, 0x88, 0x56, 0x41, 0xa7, 0xd8, 0xd6, 0x36, 0xb5, 0xad, 0x9a, 0xaf, + 0x53, 0x8c, 0x10, 0x18, 0x71, 0x10, 0x11, 0x5b, 0x17, 0x19, 0x71, 0x46, 0xeb, 0x50, 0x9e, 0xa6, + 0xd4, 0x2e, 0x67, 0x29, 0xcf, 0x9c, 0xcf, 0x9c, 0xf2, 0x33, 0xbf, 0xe7, 0x67, 0xb9, 0xac, 0x1d, + 0x07, 0x3c, 0xb0, 0x0d, 0xd9, 0x9e, 0x9d, 0x51, 0x0b, 0x2a, 0xc9, 0x71, 0x4c, 0x52, 0xbb,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0x01, 0xac, 0x52, 0xdc, + 0x0f, 0x17, 0xe8, 0xe4, 0x84, 0xcb, 0xac, 0x8b, 0xf8, 0xbd, 0x7f, 0x4e, 0x67, 0x4e, 0x69, 0x3e, + 0x73, 0x1a, 0xc5, 0x2c, 0xbb, 0x98, 0x39, 0x96, 0x44, 0x44, 0x71, 0xc8, 0x5c, 0xbf, 0x41, 0x71, + 0xa1, 0xaa, 0x10, 0xbd, 0x06, 0x58, 0x12, 0xa2, 0x22, 0x38, 0x0a, 0x4c, 0xd6, 0x36, 0x5a, 0x1a, + 0x29, 0x6c, 0xe3, 0x19, 0xd9, 0x2c, 0x5f, 0xb6, 0xa1, 0x7b, 0x60, 0xc4, 0x03, 0x9e, 0x23, 0x6c, + 0x2d, 0xb5, 0xab, 0x47, 0xd7, 0xab, 0x2b, 0x70, 0xc6, 0xfe, 0xde, 0x21, 0xf3, 0x45, 0xbf, 0x9c, + 0xed, 0x3d, 0x3e, 0xfd, 0xda, 0x2e, 0x9d, 0xce, 0xdb, 0xda, 0xd9, 0xbc, 0xad, 0x7d, 0x99, 0xb7, + 0xb5, 0xf7, 0xe7, 0xed, 0xd2, 0xd9, 0x79, 0xbb, 0xf4, 0xf9, 0xbc, 0x5d, 0x7a, 0xf1, 0xff, 0x90, + 0xf2, 0xd1, 0xf4, 0xa8, 0x13, 0x26, 0x51, 0x37, 0xfb, 0x6e, 0x4c, 0x78, 0x57, 0x7d, 0xbf, 0x1b, + 0x25, 0x78, 0x3a, 0x26, 0x2c, 0xfb, 0x37, 0x74, 0xf9, 0xc9, 0x84, 0xb0, 0xa3, 0x15, 0xf1, 0xda, + 0xdf, 0xf9, 0x11, 0x00, 0x00, 0xff, 0xff, 0x48, 0x8f, 0xbe, 0x63, 0x33, 0x06, 0x00, 0x00, } func (this *BaseNFT) Equal(that interface{}) bool { @@ -472,6 +518,9 @@ func (this *NFTMetadata) Equal(that interface{}) bool { if this.Data != that1.Data { return false } + if !this.RentalInfo.Equal(that1.RentalInfo) { + return false + } return true } func (this *Denom) Equal(that interface{}) bool { @@ -562,6 +611,9 @@ func (this *DenomMetadata) Equal(that interface{}) bool { if this.Data != that1.Data { return false } + if !this.RentalPlugin.Equal(that1.RentalPlugin) { + return false + } return true } func (this *IDCollection) Equal(that interface{}) bool { @@ -725,6 +777,41 @@ func (m *BaseNFT) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PluginInfo) 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 *PluginInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PluginInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RentalInfo != nil { + { + size, err := m.RentalInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + func (m *NFTMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -745,6 +832,18 @@ func (m *NFTMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.RentalInfo != nil { + { + size, err := m.RentalInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } if len(m.Data) > 0 { i -= len(m.Data) copy(dAtA[i:], m.Data) @@ -868,6 +967,41 @@ func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DenomPlugin) 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 *DenomPlugin) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomPlugin) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RentalPlugin != nil { + { + size, err := m.RentalPlugin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil +} + func (m *DenomMetadata) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -888,6 +1022,18 @@ func (m *DenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.RentalPlugin != nil { + { + size, err := m.RentalPlugin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } if len(m.Data) > 0 { i -= len(m.Data) copy(dAtA[i:], m.Data) @@ -932,41 +1078,6 @@ func (m *DenomMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *DenomUserdata) 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 *DenomUserdata) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DenomUserdata) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.RentalMetadata != nil { - { - size, err := m.RentalMetadata.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintNft(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *IDCollection) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1141,6 +1252,19 @@ func (m *BaseNFT) Size() (n int) { return n } +func (m *PluginInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RentalInfo != nil { + l = m.RentalInfo.Size() + n += 1 + l + sovNft(uint64(l)) + } + return n +} + func (m *NFTMetadata) Size() (n int) { if m == nil { return 0 @@ -1155,6 +1279,10 @@ func (m *NFTMetadata) Size() (n int) { if l > 0 { n += 1 + l + sovNft(uint64(l)) } + if m.RentalInfo != nil { + l = m.RentalInfo.Size() + n += 1 + l + sovNft(uint64(l)) + } return n } @@ -1209,6 +1337,19 @@ func (m *Denom) Size() (n int) { return n } +func (m *DenomPlugin) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.RentalPlugin != nil { + l = m.RentalPlugin.Size() + n += 1 + l + sovNft(uint64(l)) + } + return n +} + func (m *DenomMetadata) Size() (n int) { if m == nil { return 0 @@ -1233,17 +1374,8 @@ func (m *DenomMetadata) Size() (n int) { if l > 0 { n += 1 + l + sovNft(uint64(l)) } - return n -} - -func (m *DenomUserdata) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RentalMetadata != nil { - l = m.RentalMetadata.Size() + if m.RentalPlugin != nil { + l = m.RentalPlugin.Size() n += 1 + l + sovNft(uint64(l)) } return n @@ -1552,6 +1684,92 @@ func (m *BaseNFT) Unmarshal(dAtA []byte) error { } return nil } +func (m *PluginInfo) 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 ErrIntOverflowNft + } + 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: PluginInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PluginInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RentalInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RentalInfo == nil { + m.RentalInfo = &RentalInfo{} + } + if err := m.RentalInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *NFTMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1645,6 +1863,42 @@ func (m *NFTMetadata) Unmarshal(dAtA []byte) error { } m.Data = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RentalInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RentalInfo == nil { + m.RentalInfo = &RentalInfo{} + } + if err := m.RentalInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipNft(dAtA[iNdEx:]) @@ -2044,6 +2298,92 @@ func (m *Denom) Unmarshal(dAtA []byte) error { } return nil } +func (m *DenomPlugin) 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 ErrIntOverflowNft + } + 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: DenomPlugin: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomPlugin: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RentalPlugin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RentalPlugin == nil { + m.RentalPlugin = &RentalPlugin{} + } + if err := m.RentalPlugin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *DenomMetadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2209,59 +2549,9 @@ func (m *DenomMetadata) Unmarshal(dAtA []byte) error { } m.Data = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNft(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthNft - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DenomUserdata) 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 ErrIntOverflowNft - } - 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: DenomUserdata: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DenomUserdata: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 7: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RentalMetadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RentalPlugin", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2288,10 +2578,10 @@ func (m *DenomUserdata) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.RentalMetadata == nil { - m.RentalMetadata = &RentalMetadata{} + if m.RentalPlugin == nil { + m.RentalPlugin = &RentalPlugin{} } - if err := m.RentalMetadata.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.RentalPlugin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/modules/nft/types/rental.pb.go b/modules/nft/types/rental.pb.go index 6a03632c..fb3ba1b4 100644 --- a/modules/nft/types/rental.pb.go +++ b/modules/nft/types/rental.pb.go @@ -23,26 +23,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// RentalInfo defines a rental info -type RentalInfo struct { - User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - DenomId string `protobuf:"bytes,2,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` - NftId string `protobuf:"bytes,3,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` - Expires int64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` +// RentalPlugin defines the message for a denom rental plugin config +type RentalPlugin struct { + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` } -func (m *RentalInfo) Reset() { *m = RentalInfo{} } -func (m *RentalInfo) String() string { return proto.CompactTextString(m) } -func (*RentalInfo) ProtoMessage() {} -func (*RentalInfo) Descriptor() ([]byte, []int) { +func (m *RentalPlugin) Reset() { *m = RentalPlugin{} } +func (m *RentalPlugin) String() string { return proto.CompactTextString(m) } +func (*RentalPlugin) ProtoMessage() {} +func (*RentalPlugin) Descriptor() ([]byte, []int) { return fileDescriptor_e57beeaf512eaaa2, []int{0} } -func (m *RentalInfo) XXX_Unmarshal(b []byte) error { +func (m *RentalPlugin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *RentalInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *RentalPlugin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_RentalInfo.Marshal(b, m, deterministic) + return xxx_messageInfo_RentalPlugin.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -52,63 +49,43 @@ func (m *RentalInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *RentalInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_RentalInfo.Merge(m, src) +func (m *RentalPlugin) XXX_Merge(src proto.Message) { + xxx_messageInfo_RentalPlugin.Merge(m, src) } -func (m *RentalInfo) XXX_Size() int { +func (m *RentalPlugin) XXX_Size() int { return m.Size() } -func (m *RentalInfo) XXX_DiscardUnknown() { - xxx_messageInfo_RentalInfo.DiscardUnknown(m) +func (m *RentalPlugin) XXX_DiscardUnknown() { + xxx_messageInfo_RentalPlugin.DiscardUnknown(m) } -var xxx_messageInfo_RentalInfo proto.InternalMessageInfo +var xxx_messageInfo_RentalPlugin proto.InternalMessageInfo -func (m *RentalInfo) GetUser() string { +func (m *RentalPlugin) GetEnabled() bool { if m != nil { - return m.User - } - return "" -} - -func (m *RentalInfo) GetDenomId() string { - if m != nil { - return m.DenomId - } - return "" -} - -func (m *RentalInfo) GetNftId() string { - if m != nil { - return m.NftId - } - return "" -} - -func (m *RentalInfo) GetExpires() int64 { - if m != nil { - return m.Expires + return m.Enabled } - return 0 + return false } -// RentalMetadata defines rental plugin -type RentalMetadata struct { - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` +// RentalInfo defines the message for an nft rental info +type RentalInfo struct { + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Expires int64 `protobuf:"varint,2,opt,name=expires,proto3" json:"expires,omitempty"` } -func (m *RentalMetadata) Reset() { *m = RentalMetadata{} } -func (m *RentalMetadata) String() string { return proto.CompactTextString(m) } -func (*RentalMetadata) ProtoMessage() {} -func (*RentalMetadata) Descriptor() ([]byte, []int) { +func (m *RentalInfo) Reset() { *m = RentalInfo{} } +func (m *RentalInfo) String() string { return proto.CompactTextString(m) } +func (*RentalInfo) ProtoMessage() {} +func (*RentalInfo) Descriptor() ([]byte, []int) { return fileDescriptor_e57beeaf512eaaa2, []int{1} } -func (m *RentalMetadata) XXX_Unmarshal(b []byte) error { +func (m *RentalInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *RentalMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *RentalInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_RentalMetadata.Marshal(b, m, deterministic) + return xxx_messageInfo_RentalInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -118,53 +95,109 @@ func (m *RentalMetadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return b[:n], nil } } -func (m *RentalMetadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_RentalMetadata.Merge(m, src) +func (m *RentalInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RentalInfo.Merge(m, src) } -func (m *RentalMetadata) XXX_Size() int { +func (m *RentalInfo) XXX_Size() int { return m.Size() } -func (m *RentalMetadata) XXX_DiscardUnknown() { - xxx_messageInfo_RentalMetadata.DiscardUnknown(m) +func (m *RentalInfo) XXX_DiscardUnknown() { + xxx_messageInfo_RentalInfo.DiscardUnknown(m) } -var xxx_messageInfo_RentalMetadata proto.InternalMessageInfo +var xxx_messageInfo_RentalInfo proto.InternalMessageInfo + +func (m *RentalInfo) GetUser() string { + if m != nil { + return m.User + } + return "" +} -func (m *RentalMetadata) GetEnabled() bool { +func (m *RentalInfo) GetExpires() int64 { if m != nil { - return m.Enabled + return m.Expires } - return false + return 0 } func init() { + proto.RegisterType((*RentalPlugin)(nil), "irismod.nft.RentalPlugin") proto.RegisterType((*RentalInfo)(nil), "irismod.nft.RentalInfo") - proto.RegisterType((*RentalMetadata)(nil), "irismod.nft.RentalMetadata") } func init() { proto.RegisterFile("nft/rental.proto", fileDescriptor_e57beeaf512eaaa2) } var fileDescriptor_e57beeaf512eaaa2 = []byte{ - // 247 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x50, 0xcd, 0x4a, 0xc4, 0x30, - 0x10, 0xde, 0xb8, 0xeb, 0xee, 0x1a, 0x41, 0x24, 0x28, 0x54, 0x0f, 0x61, 0xd9, 0xd3, 0x22, 0xd2, - 0x1c, 0x7c, 0x03, 0x0f, 0x42, 0x0f, 0x5e, 0x7a, 0xf4, 0x22, 0xa9, 0x99, 0xd4, 0x40, 0x9b, 0x94, - 0x64, 0x0a, 0xfa, 0x16, 0x3e, 0x96, 0xc7, 0x3d, 0x7a, 0x94, 0xf6, 0x45, 0xa4, 0xb3, 0xee, 0xed, - 0xfb, 0x1b, 0x3e, 0xbe, 0xe1, 0x97, 0xde, 0xa2, 0x8a, 0xe0, 0x51, 0x37, 0x79, 0x17, 0x03, 0x06, - 0x71, 0xee, 0xa2, 0x4b, 0x6d, 0x30, 0xb9, 0xb7, 0x78, 0x7b, 0x55, 0x87, 0x3a, 0x90, 0xae, 0x26, - 0x74, 0x88, 0x6c, 0x1b, 0xce, 0x4b, 0x3a, 0x29, 0xbc, 0x0d, 0x42, 0xf0, 0x45, 0x9f, 0x20, 0x66, - 0x6c, 0xc3, 0x76, 0x67, 0x25, 0x61, 0x71, 0xc3, 0xd7, 0x06, 0x7c, 0x68, 0x5f, 0x9d, 0xc9, 0x4e, - 0x48, 0x5f, 0x11, 0x2f, 0x8c, 0xb8, 0xe6, 0x4b, 0x6f, 0x71, 0x32, 0xe6, 0x64, 0x9c, 0x7a, 0x8b, - 0x85, 0x11, 0x19, 0x5f, 0xc1, 0x47, 0xe7, 0x22, 0xa4, 0x6c, 0xb1, 0x61, 0xbb, 0x79, 0x79, 0xa4, - 0xdb, 0x3b, 0x7e, 0x71, 0x68, 0x7b, 0x06, 0xd4, 0x46, 0xa3, 0xa6, 0xac, 0xd7, 0x55, 0x03, 0x86, - 0x4a, 0xd7, 0xe5, 0x91, 0x3e, 0x3e, 0x7d, 0x0f, 0x92, 0xed, 0x07, 0xc9, 0x7e, 0x07, 0xc9, 0xbe, - 0x46, 0x39, 0xdb, 0x8f, 0x72, 0xf6, 0x33, 0xca, 0xd9, 0xcb, 0x7d, 0xed, 0xf0, 0xbd, 0xaf, 0xf2, - 0xb7, 0xd0, 0xaa, 0x69, 0xa1, 0x07, 0x54, 0xff, 0x4b, 0x55, 0x1b, 0x4c, 0xdf, 0x40, 0x52, 0xd3, - 0x2f, 0xf0, 0xb3, 0x83, 0x54, 0x2d, 0x69, 0xe8, 0xc3, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x77, - 0xaf, 0x08, 0x82, 0x1f, 0x01, 0x00, 0x00, + // 220 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x4b, 0x2b, 0xd1, + 0x2f, 0x4a, 0xcd, 0x2b, 0x49, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xce, 0x2c, + 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0xcb, 0x4b, 0x2b, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, + 0x8b, 0xeb, 0x83, 0x58, 0x10, 0x25, 0x4a, 0x7a, 0x5c, 0x3c, 0x41, 0x60, 0x2d, 0x01, 0x39, 0xa5, + 0xe9, 0x99, 0x79, 0x42, 0x12, 0x5c, 0xec, 0xa9, 0x79, 0x89, 0x49, 0x39, 0xa9, 0x29, 0x12, 0x8c, + 0x0a, 0x8c, 0x1a, 0x1c, 0x41, 0x30, 0xae, 0x15, 0xcb, 0x8b, 0x05, 0xf2, 0x8c, 0x4a, 0x0e, 0x5c, + 0x5c, 0x10, 0xf5, 0x9e, 0x79, 0x69, 0xf9, 0x42, 0x42, 0x5c, 0x2c, 0xa5, 0xc5, 0xa9, 0x45, 0x60, + 0xa5, 0x9c, 0x41, 0x60, 0x36, 0xd8, 0x84, 0x8a, 0x82, 0xcc, 0xa2, 0xd4, 0x62, 0x09, 0x26, 0x05, + 0x46, 0x0d, 0xe6, 0x20, 0x18, 0x17, 0x62, 0x82, 0x93, 0xdb, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, + 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, + 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, + 0x83, 0x5c, 0x9e, 0x97, 0x5a, 0xa2, 0x0f, 0xf5, 0x81, 0x7e, 0x6e, 0x7e, 0x4a, 0x69, 0x4e, 0x6a, + 0xb1, 0x3e, 0xc8, 0x8f, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x0f, 0x18, 0x03, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x71, 0xc4, 0xc4, 0x34, 0xf7, 0x00, 0x00, 0x00, } -func (m *RentalInfo) Marshal() (dAtA []byte, err error) { +func (this *RentalPlugin) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RentalPlugin) + if !ok { + that2, ok := that.(RentalPlugin) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Enabled != that1.Enabled { + return false + } + return true +} +func (this *RentalInfo) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*RentalInfo) + if !ok { + that2, ok := that.(RentalInfo) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.User != that1.User { + return false + } + if this.Expires != that1.Expires { + return false + } + return true +} +func (m *RentalPlugin) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -174,46 +207,30 @@ func (m *RentalInfo) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RentalInfo) MarshalTo(dAtA []byte) (int, error) { +func (m *RentalPlugin) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RentalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RentalPlugin) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Expires != 0 { - i = encodeVarintRental(dAtA, i, uint64(m.Expires)) - i-- - dAtA[i] = 0x20 - } - if len(m.NftId) > 0 { - i -= len(m.NftId) - copy(dAtA[i:], m.NftId) - i = encodeVarintRental(dAtA, i, uint64(len(m.NftId))) - i-- - dAtA[i] = 0x1a - } - if len(m.DenomId) > 0 { - i -= len(m.DenomId) - copy(dAtA[i:], m.DenomId) - i = encodeVarintRental(dAtA, i, uint64(len(m.DenomId))) + if m.Enabled { i-- - dAtA[i] = 0x12 - } - if len(m.User) > 0 { - i -= len(m.User) - copy(dAtA[i:], m.User) - i = encodeVarintRental(dAtA, i, uint64(len(m.User))) + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } -func (m *RentalMetadata) Marshal() (dAtA []byte, err error) { +func (m *RentalInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -223,25 +240,27 @@ func (m *RentalMetadata) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *RentalMetadata) MarshalTo(dAtA []byte) (int, error) { +func (m *RentalInfo) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *RentalMetadata) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *RentalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Enabled { + if m.Expires != 0 { + i = encodeVarintRental(dAtA, i, uint64(m.Expires)) i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } + dAtA[i] = 0x10 + } + if len(m.User) > 0 { + i -= len(m.User) + copy(dAtA[i:], m.User) + i = encodeVarintRental(dAtA, i, uint64(len(m.User))) i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -257,38 +276,30 @@ func encodeVarintRental(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *RentalInfo) Size() (n int) { +func (m *RentalPlugin) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.User) - if l > 0 { - n += 1 + l + sovRental(uint64(l)) - } - l = len(m.DenomId) - if l > 0 { - n += 1 + l + sovRental(uint64(l)) - } - l = len(m.NftId) - if l > 0 { - n += 1 + l + sovRental(uint64(l)) - } - if m.Expires != 0 { - n += 1 + sovRental(uint64(m.Expires)) + if m.Enabled { + n += 2 } return n } -func (m *RentalMetadata) Size() (n int) { +func (m *RentalInfo) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.Enabled { - n += 2 + l = len(m.User) + if l > 0 { + n += 1 + l + sovRental(uint64(l)) + } + if m.Expires != 0 { + n += 1 + sovRental(uint64(m.Expires)) } return n } @@ -299,7 +310,7 @@ func sovRental(x uint64) (n int) { func sozRental(x uint64) (n int) { return sovRental(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *RentalInfo) Unmarshal(dAtA []byte) error { +func (m *RentalPlugin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -322,113 +333,17 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RentalInfo: wiretype end group for non-group") + return fmt.Errorf("proto: RentalPlugin: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RentalInfo: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RentalPlugin: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRental - } - 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 ErrInvalidLengthRental - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRental - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.User = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DenomId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRental - } - 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 ErrInvalidLengthRental - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRental - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DenomId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NftId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRental - } - 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 ErrInvalidLengthRental - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRental - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NftId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) } - m.Expires = 0 + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRental @@ -438,11 +353,12 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Expires |= int64(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.Enabled = bool(v != 0) default: iNdEx = preIndex skippy, err := skipRental(dAtA[iNdEx:]) @@ -464,7 +380,7 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { } return nil } -func (m *RentalMetadata) Unmarshal(dAtA []byte) error { +func (m *RentalInfo) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -487,17 +403,49 @@ func (m *RentalMetadata) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: RentalMetadata: wiretype end group for non-group") + return fmt.Errorf("proto: RentalInfo: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: RentalMetadata: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: RentalInfo: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field User", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRental + } + 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 ErrInvalidLengthRental + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRental + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.User = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) } - var v int + m.Expires = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRental @@ -507,12 +455,11 @@ func (m *RentalMetadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= int(b&0x7F) << shift + m.Expires |= int64(b&0x7F) << shift if b < 0x80 { break } } - m.Enabled = bool(v != 0) default: iNdEx = preIndex skippy, err := skipRental(dAtA[iNdEx:]) diff --git a/proto/nft/nft.proto b/proto/nft/nft.proto index dde32144..e55469bf 100644 --- a/proto/nft/nft.proto +++ b/proto/nft/nft.proto @@ -19,11 +19,18 @@ message BaseNFT { string uri_hash = 6; } +message PluginInfo { + // RoyaltyInfo royaltyInfo = 1 [] ; + RentalInfo rentalInfo = 2 [ (gogoproto.jsontag) = "irismod:4907" ]; +} + message NFTMetadata { option (gogoproto.equal) = true; string name = 1; string data = 2; + // RoyaltyInfo royaltyInfo = 3 []; + RentalInfo rentalInfo = 4 [ (gogoproto.jsontag) = "irismod:4907" ]; } // Denom defines a type of NFT @@ -43,6 +50,11 @@ message Denom { string data = 11; } +message DenomPlugin { + // RoyaltyPlugin royaltyPlugin = 1 [] ; + RentalPlugin rentalPlugin = 2 [ (gogoproto.jsontag) = "irismod:4907" ]; +} + message DenomMetadata { option (gogoproto.equal) = true; @@ -51,11 +63,9 @@ message DenomMetadata { bool mint_restricted = 3; bool update_restricted = 4; string data = 5; -} -// DenomUserData defines the unmarshalled DenomMetadata.data -message DenomUserdata { - RentalMetadata rentalMetadata = 1 [ (gogoproto.jsontag) = "irismod:4907" ]; + // RoyaltyPlugin royaltyPlugin = 6 []; + RentalPlugin rentalPlugin = 7 [ (gogoproto.jsontag) = "irismod:4907" ]; } // IDCollection defines a type of collection with specified ID diff --git a/proto/nft/rental.proto b/proto/nft/rental.proto index 0c6c180f..7b0cdef6 100644 --- a/proto/nft/rental.proto +++ b/proto/nft/rental.proto @@ -5,13 +5,17 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/irisnet/irismod/modules/nft/types"; -// RentalInfo defines a rental info -message RentalInfo { - string user = 1; - string denom_id = 2; - string nft_id = 3; - int64 expires = 4; +// RentalPlugin defines the message for a denom rental plugin config +message RentalPlugin { + option (gogoproto.equal) = true; + + bool enabled = 1; } -// RentalMetadata defines rental plugin -message RentalMetadata { bool enabled = 1; } \ No newline at end of file +// RentalInfo defines the message for an nft rental info +message RentalInfo { + option (gogoproto.equal) = true; + + string user = 1; + int64 expires = 2; +} \ No newline at end of file From 89ced9b4184680dec84b9354adb8681d90f49d9c Mon Sep 17 00:00:00 2001 From: yuandu Date: Wed, 21 Dec 2022 18:46:48 +0800 Subject: [PATCH 18/20] rm rental keys --- modules/nft/keeper/keys.go | 60 -------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 modules/nft/keeper/keys.go diff --git a/modules/nft/keeper/keys.go b/modules/nft/keeper/keys.go deleted file mode 100644 index 271bfc83..00000000 --- a/modules/nft/keeper/keys.go +++ /dev/null @@ -1,60 +0,0 @@ -package keeper - -import ( - "reflect" - "unsafe" -) - -// As iris/nft uses x/nft as its base module, new added key must start from 0x06. -// Key of each plugin must add an PrefixPluginXxx to distinguish. -var ( - PluginRental = []byte{0x06} - - RentalInfoKey = []byte{0x01} - RentalOptionKey = []byte{0x02} - - Delimiter = []byte{0x00} -) - -// rentalInfoKey returns the byte representation of the rental info key. -// <0x06><0x01> => bz(rentalInfo) -func rentalInfoKey(classId, nftId string) []byte { - classIdBz := unsafeStrToBytes(classId) - nftIdBz := unsafeStrToBytes(nftId) - - key := make([]byte, len(PluginRental)+len(RentalInfoKey)+len(classIdBz)+len(Delimiter)+len(nftIdBz)) - - copy(key, PluginRental) - copy(key[len(PluginRental):], RentalInfoKey) - copy(key[len(PluginRental)+len(RentalInfoKey):], classIdBz) - copy(key[len(PluginRental)+len(RentalInfoKey)+len(classIdBz):], Delimiter) - copy(key[len(PluginRental)+len(RentalInfoKey)+len(classIdBz)+len(Delimiter):], nftIdBz) - return key -} - -// rentalOptionKey returns the byte representation of the rental enabled key. -// <0x06><0x02> => true:0x01,false:0x00 -func rentalOptionKey(classId string) []byte { - classIdBz := unsafeStrToBytes(classId) - - key := make([]byte, len(PluginRental)+len(RentalOptionKey)+len(classIdBz)) - - copy(key, PluginRental) - copy(key[len(PluginRental):], RentalOptionKey) - copy(key[len(PluginRental)+len(RentalOptionKey):], classIdBz) - return key -} - -// The following functions refers to cosmos-sdk/internal/conv/string.go - -// unsafeStrToBytes uses unsafe to convert string into byte array. Returned bytes -// must not be altered after this function is called as it will cause a segmentation fault. -func unsafeStrToBytes(s string) []byte { - var buf []byte - sHdr := (*reflect.StringHeader)(unsafe.Pointer(&s)) - bufHdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) - bufHdr.Data = sHdr.Data - bufHdr.Cap = sHdr.Len - bufHdr.Len = sHdr.Len - return buf -} From 3634423d2b9f43261443b3da199a393ca7bf441e Mon Sep 17 00:00:00 2001 From: yuandu Date: Thu, 22 Dec 2022 14:55:54 +0800 Subject: [PATCH 19/20] fix rental --- modules/nft/keeper/denom.go | 48 ++--- modules/nft/keeper/grpc_query.go | 4 +- modules/nft/keeper/msg_server.go | 4 +- modules/nft/keeper/nft.go | 52 +---- modules/nft/keeper/rental.go | 48 +++-- modules/nft/keeper/rental_test.go | 54 ++--- modules/nft/keeper/utils.go | 18 ++ modules/nft/keeper/utils_test.go | 7 + modules/nft/types/errors.go | 9 +- modules/nft/types/nft.pb.go | 325 +++++++++++++++++++++++++----- modules/nft/types/rental.pb.go | 57 +++--- proto/nft/nft.proto | 7 + proto/nft/rental.proto | 10 +- 13 files changed, 430 insertions(+), 213 deletions(-) create mode 100644 modules/nft/keeper/utils.go create mode 100644 modules/nft/keeper/utils_test.go diff --git a/modules/nft/keeper/denom.go b/modules/nft/keeper/denom.go index 1ca25057..e7cbcc65 100644 --- a/modules/nft/keeper/denom.go +++ b/modules/nft/keeper/denom.go @@ -1,8 +1,6 @@ package keeper import ( - "encoding/json" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -26,14 +24,14 @@ func (k Keeper) SaveDenom(ctx sdk.Context, id, ) error { // make sure that plugin has default value if failed to convert input data - denomPlugin := k.DenomDataToDenomPlugin(data) + userData, denomPlugin := decomposeDenomData(data) denomMetadata := &types.DenomMetadata{ Creator: creator.String(), Schema: schema, MintRestricted: mintRestricted, UpdateRestricted: updateRestricted, - Data: "", + Data: userData, RentalPlugin: denomPlugin.RentalPlugin, } metadata, err := codectypes.NewAnyWithValue(denomMetadata) @@ -63,6 +61,11 @@ func (k Keeper) TransferDenomOwner( return err } + plugin, err := k.GetDenomPlugin(ctx, denomID) + if err != nil { + return err + } + // authorize if srcOwner.String() != denom.Creator { return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "%s is not allowed to transfer denom %s", srcOwner.String(), denomID) @@ -74,6 +77,7 @@ func (k Keeper) TransferDenomOwner( MintRestricted: denom.MintRestricted, UpdateRestricted: denom.UpdateRestricted, Data: denom.Data, + RentalPlugin: plugin.RentalPlugin, } data, err := codectypes.NewAnyWithValue(denomMetadata) if err != nil { @@ -105,12 +109,6 @@ func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, err return nil, err } - denomPlugin := k.DenomMetadataToDenomPlugin(denomMetadata) - data, err := json.Marshal(denomPlugin) - if err != nil { - return nil, err - } - return &types.Denom{ Id: class.Id, Name: class.Name, @@ -122,7 +120,7 @@ func (k Keeper) GetDenomInfo(ctx sdk.Context, denomID string) (*types.Denom, err Description: class.Description, Uri: class.Uri, UriHash: class.UriHash, - Data: string(data), + Data: denomMetadata.Data, }, nil } @@ -131,27 +129,19 @@ func (k Keeper) HasDenom(ctx sdk.Context, denomID string) bool { return k.nk.HasClass(ctx, denomID) } -// DefaultDenomPlugin returns a default DenomPlugin -func (k Keeper) DefaultDenomPlugin() types.DenomPlugin { - rentalPlugin := k.DefaultRentalPlugin() - return types.DenomPlugin{ - RentalPlugin: &rentalPlugin, +// GetDenomPlugin returns denom plugin config of a denom +func (k Keeper) GetDenomPlugin(ctx sdk.Context, denomID string) (*types.DenomPlugin, error) { + class, has := k.nk.GetClass(ctx, denomID) + if !has { + return nil, sdkerrors.Wrapf(types.ErrInvalidDenom, "denom ID %s not exists", denomID) } -} -// DenomDataToDenomPlugin converts user denom data to denom plugin struct -func (k Keeper) DenomDataToDenomPlugin(data string) types.DenomPlugin { - var denomPlugin types.DenomPlugin - if err := json.Unmarshal([]byte(data), &denomPlugin); err != nil { - denomPlugin = k.DefaultDenomPlugin() + var denomMetadata types.DenomMetadata + if err := k.cdc.Unmarshal(class.Data.GetValue(), &denomMetadata); err != nil { + return nil, err } - return denomPlugin -} -// DenomMetadataToDenomPlugin extracts plugin config from denom metadata -func (k Keeper) DenomMetadataToDenomPlugin(denomMetadata types.DenomMetadata) types.DenomPlugin { - denomPlugin := types.DenomPlugin{ + return &types.DenomPlugin{ RentalPlugin: denomMetadata.RentalPlugin, - } - return denomPlugin + }, nil } diff --git a/modules/nft/keeper/grpc_query.go b/modules/nft/keeper/grpc_query.go index 14637986..d4676bf7 100644 --- a/modules/nft/keeper/grpc_query.go +++ b/modules/nft/keeper/grpc_query.go @@ -209,7 +209,7 @@ func (k Keeper) UserExpires(goCtx context.Context, msg *types.QueryUserExpiresRe return nil, err } - return &types.QueryUserExpiresResponse{Expires: rental.Expires}, nil + return &types.QueryUserExpiresResponse{Expires: rental.Expiry}, nil } // HasUser queries if an nft has the user @@ -227,7 +227,7 @@ func (k Keeper) HasUser(goCtx context.Context, msg *types.QueryHasUserRequest) ( // if expires or user not existent, return false var resp types.QueryHasUserResponse - if ctx.BlockTime().Unix() > rental.Expires || rental.User == "" { + if ctx.BlockTime().Unix() > rental.Expiry || rental.User == "" { resp.HasUser = false } diff --git a/modules/nft/keeper/msg_server.go b/modules/nft/keeper/msg_server.go index 472688b0..96b95783 100644 --- a/modules/nft/keeper/msg_server.go +++ b/modules/nft/keeper/msg_server.go @@ -271,8 +271,8 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms } if err := k.Rent(ctx, msg.DenomId, msg.NftId, types.RentalInfo{ - User: user.String(), - Expires: msg.Expires, + User: user.String(), + Expiry: msg.Expires, }); err != nil { return nil, err } diff --git a/modules/nft/keeper/nft.go b/modules/nft/keeper/nft.go index 43da392c..ccd84971 100644 --- a/modules/nft/keeper/nft.go +++ b/modules/nft/keeper/nft.go @@ -1,8 +1,6 @@ package keeper import ( - "encoding/json" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -21,13 +19,9 @@ func (k Keeper) SaveNFT(ctx sdk.Context, denomID, tokenData string, receiver sdk.AccAddress, ) error { - - pluginInfo := k.TokenDataToPluginInfo(tokenData) - nftMetadata := &types.NFTMetadata{ - Name: tokenNm, - Data: "", - RentalInfo: pluginInfo.RentalInfo, + Name: tokenNm, + Data: tokenData, } data, err := codectypes.NewAnyWithValue(nftMetadata) if err != nil { @@ -175,18 +169,12 @@ func (k Keeper) GetNFT(ctx sdk.Context, denomID, tokenID string) (nft exported.N return nil, err } - pluginInfo := k.TokenMetadataToPluginInfo(nftMetadata) - data, err := json.Marshal(pluginInfo) - if err != nil { - return nil, err - } - owner := k.nk.GetOwner(ctx, denomID, tokenID) return types.BaseNFT{ Id: token.Id, Name: nftMetadata.Name, URI: token.Uri, - Data: string(data), + Data: nftMetadata.Data, Owner: owner.String(), UriHash: token.UriHash, }, nil @@ -200,19 +188,12 @@ func (k Keeper) GetNFTs(ctx sdk.Context, denom string) (nfts []exported.NFT, err if err := k.cdc.Unmarshal(token.Data.GetValue(), &nftMetadata); err != nil { return nil, err } - - pluginInfo := k.TokenMetadataToPluginInfo(nftMetadata) - data, err := json.Marshal(pluginInfo) - if err != nil { - return nil, err - } - nfts = append(nfts, types.BaseNFT{ Id: token.GetId(), Name: nftMetadata.Name, URI: token.GetUri(), UriHash: token.GetUriHash(), - Data: string(data), + Data: nftMetadata.Data, Owner: k.nk.GetOwner(ctx, denom, token.GetId()).String(), }) } @@ -232,28 +213,3 @@ func (k Keeper) Authorize(ctx sdk.Context, denomID, tokenID string, owner sdk.Ac func (k Keeper) HasNFT(ctx sdk.Context, denomID, tokenID string) bool { return k.nk.HasNFT(ctx, denomID, tokenID) } - -// DefaultPluginInfo returns a default PluginInfo -func (k Keeper) DefaultPluginInfo() types.PluginInfo { - rentalInfo := k.DefaultRentalInfo() - return types.PluginInfo{ - RentalInfo: &rentalInfo, - } -} - -// TokenDataToPluginInfo converts user token data to plugin info struct -func (k Keeper) TokenDataToPluginInfo(data string) types.PluginInfo { - var pluginInfo types.PluginInfo - if err := json.Unmarshal([]byte(data), &pluginInfo); err != nil { - pluginInfo = k.DefaultPluginInfo() - } - return pluginInfo -} - -// TokenMetadataToPluginInfo extracts plugin info from token metadata -func (k Keeper) TokenMetadataToPluginInfo(tokenMetadata types.NFTMetadata) types.PluginInfo { - pluginInfo := types.PluginInfo{ - RentalInfo: tokenMetadata.RentalInfo, - } - return pluginInfo -} diff --git a/modules/nft/keeper/rental.go b/modules/nft/keeper/rental.go index 209db471..1d276c42 100644 --- a/modules/nft/keeper/rental.go +++ b/modules/nft/keeper/rental.go @@ -8,19 +8,25 @@ import ( "github.com/irisnet/irismod/modules/nft/types" ) +const defaultExpiry = 0 + // DefaultRentalPlugin returns a default rental plugin config -func (k Keeper) DefaultRentalPlugin() types.RentalPlugin { - return types.RentalPlugin{Enabled: false} +func (k Keeper) DefaultRentalPlugin() *types.RentalPlugin { + return &types.RentalPlugin{ + Enabled: false, + } } -func (k Keeper) DefaultRentalInfo() types.RentalInfo { - return types.RentalInfo{ - User: "", - Expires: 0, +// DefaultRentalInfo returns a default rental info +func (k Keeper) DefaultRentalInfo() *types.RentalInfo { + return &types.RentalInfo{ + User: "", + Expiry: defaultExpiry, } } -// Rent set or update rental info for an nft. +// Rent set rental info for an nft. +// Warning: Rent will overwrite previous rental info no matter whether it arrives expiry thus should be used carefully. func (k Keeper) Rent(ctx sdk.Context, denomID, tokenID string, rental types.RentalInfo) error { // 1. get rental plugin info cfg, err := k.GetRentalPlugin(ctx, denomID) @@ -30,12 +36,12 @@ func (k Keeper) Rent(ctx sdk.Context, denomID, tokenID string, rental types.Rent // 2. check rental is enabled if !cfg.Enabled { - return sdkerrors.Wrapf(types.ErrRentalOption, "Rental is disabled") + return sdkerrors.Wrapf(types.ErrRentalPluginDisabled, "Rental is disabled") } // 3. expiry must be greater than the current block time. - if ctx.BlockTime().Unix() >= rental.Expires { - return sdkerrors.Wrapf(types.ErrInvalidExpiry, "Expiry is (%d)", rental.Expires) + if ctx.BlockTime().Unix() >= rental.Expiry { + return sdkerrors.Wrapf(types.ErrRentalExpiryInvalid, "Expiry is (%d)", rental.Expiry) } // 4. construct new nft data info (we have examined its existence) @@ -63,7 +69,6 @@ func (k Keeper) Rent(ctx sdk.Context, denomID, tokenID string, rental types.Rent // GetRentalPlugin returns the rental plugin config func (k Keeper) GetRentalPlugin(ctx sdk.Context, denomID string) (*types.RentalPlugin, error) { - var r *types.RentalPlugin denom, has := k.nk.GetClass(ctx, denomID) if !has { return nil, sdkerrors.Wrapf(types.ErrInvalidDenom, "denom ID %s not exists", denomID) @@ -74,14 +79,15 @@ func (k Keeper) GetRentalPlugin(ctx sdk.Context, denomID string) (*types.RentalP return nil, err } - r = denomMetadata.RentalPlugin - return r, nil + if denomMetadata.RentalPlugin != nil { + return denomMetadata.RentalPlugin, nil + } + + return k.DefaultRentalPlugin(), nil } -// GetRentalInfo returns the rental info for an nft. -func (k Keeper) GetRentalInfo(ctx sdk.Context, - denomID, tokenID string) (*types.RentalInfo, error) { - var r *types.RentalInfo +// GetRentalInfo returns the rental info of an nft. +func (k Keeper) GetRentalInfo(ctx sdk.Context, denomID, tokenID string) (*types.RentalInfo, error) { token, exist := k.nk.GetNFT(ctx, denomID, tokenID) if !exist { return nil, sdkerrors.Wrapf(types.ErrInvalidNFT, "token ID %s not exists", tokenID) @@ -91,6 +97,10 @@ func (k Keeper) GetRentalInfo(ctx sdk.Context, if err := k.cdc.Unmarshal(token.Data.GetValue(), &nftMetadata); err != nil { return nil, err } - r = nftMetadata.RentalInfo - return r, nil + + if nftMetadata.RentalInfo != nil { + return nftMetadata.RentalInfo, nil + } + + return k.DefaultRentalInfo(), nil } diff --git a/modules/nft/keeper/rental_test.go b/modules/nft/keeper/rental_test.go index 62da8c7c..4c786cc8 100644 --- a/modules/nft/keeper/rental_test.go +++ b/modules/nft/keeper/rental_test.go @@ -6,24 +6,28 @@ import ( ) var ( - rentalDenomId = "rentalDenomId" - rentalDenomId2 = "rentalDenomId2" - rentalDenomName = "rentalDenomName" - rentalSchema = "rental schema" - rentalSymbol = "ren" - rentalNftId = "rentalNftId" - rentalNftId2 = "rentalNftId2" - rentalNftId3 = "rentalNftId3" - rentalNftName = "rentalNftName" + rentalDenomId = "rentalDenomId" + rentalDenomId2 = "rentalDenomId2" + rentalDenomName = "rentalDenomName" + rentalDenomUserData = "rentalDenomUserData" + rentalSchema = "rental schema" + rentalSymbol = "ren" + rentalNftId = "rentalNftId" + rentalNftId2 = "rentalNftId2" + rentalNftId3 = "rentalNftId3" + rentalNftName = "rentalNftName" rentalCreator = CreateTestAddrs(4)[3] rentalRenter = CreateTestAddrs(5)[4] - rentalUserData = types.DenomPlugin{ - RentalPlugin: &types.RentalPlugin{Enabled: true}, + rentalUserData = types.DenomComposedData{ + UserData: rentalDenomUserData, + DenomPlugin: &types.DenomPlugin{RentalPlugin: &types.RentalPlugin{Enabled: true}}, } - rentalUserData2 = types.DenomPlugin{ - RentalPlugin: &types.RentalPlugin{Enabled: false}, + + rentalUserData2 = types.DenomComposedData{ + UserData: rentalDenomUserData, + DenomPlugin: &types.DenomPlugin{RentalPlugin: &types.RentalPlugin{Enabled: false}}, } ) @@ -110,8 +114,8 @@ func (suite *KeeperSuite) TestSetUser() { rentalDenomId, rentalNftId, types.RentalInfo{ - User: rentalRenter.String(), - Expires: expiry, + User: rentalRenter.String(), + Expiry: expiry, }) suite.NoError(err) @@ -120,8 +124,8 @@ func (suite *KeeperSuite) TestSetUser() { rentalDenomId, rentalNftId, types.RentalInfo{ - User: rentalRenter.String(), - Expires: expiry2, + User: rentalRenter.String(), + Expiry: expiry2, }) suite.Error(err) @@ -130,8 +134,8 @@ func (suite *KeeperSuite) TestSetUser() { rentalDenomId2, rentalNftId3, types.RentalInfo{ - User: rentalRenter.String(), - Expires: expiry2, + User: rentalRenter.String(), + Expiry: expiry2, }) suite.Error(err) } @@ -143,8 +147,8 @@ func (suite *KeeperSuite) TestUserOf() { rentalDenomId, rentalNftId, types.RentalInfo{ - User: rentalRenter.String(), - Expires: expiry, + User: rentalRenter.String(), + Expiry: expiry, }) suite.NoError(err) @@ -162,8 +166,8 @@ func (suite *KeeperSuite) TestUserExpires() { rentalDenomId, rentalNftId, types.RentalInfo{ - User: rentalRenter.String(), - Expires: expiry, + User: rentalRenter.String(), + Expiry: expiry, }) suite.NoError(err) @@ -182,8 +186,8 @@ func (suite *KeeperSuite) TestHasUser() { rentalDenomId, rentalNftId, types.RentalInfo{ - User: rentalRenter.String(), - Expires: expiry, + User: rentalRenter.String(), + Expiry: expiry, }) suite.NoError(err) diff --git a/modules/nft/keeper/utils.go b/modules/nft/keeper/utils.go new file mode 100644 index 00000000..88227e75 --- /dev/null +++ b/modules/nft/keeper/utils.go @@ -0,0 +1,18 @@ +package keeper + +import ( + "encoding/json" + "github.com/irisnet/irismod/modules/nft/types" +) + +// decomposeDenomData decomposes "{"data":"","denomPlugin":""} into data string and denomPlugin struct +func decomposeDenomData(data string) (string, *types.DenomPlugin) { + var dcd types.DenomComposedData + + // if failed to unmarshal, return DenomPlugin with nil field + if err := json.Unmarshal([]byte(data), &dcd); err != nil { + return data, &types.DenomPlugin{RentalPlugin: nil} + } + + return dcd.UserData, dcd.DenomPlugin +} diff --git a/modules/nft/keeper/utils_test.go b/modules/nft/keeper/utils_test.go new file mode 100644 index 00000000..2bc9611c --- /dev/null +++ b/modules/nft/keeper/utils_test.go @@ -0,0 +1,7 @@ +package keeper_test + +import "testing" + +func TestDecomposeDenomData(t *testing.T) { + // TODO +} diff --git a/modules/nft/types/errors.go b/modules/nft/types/errors.go index d76fd404..f43ec267 100644 --- a/modules/nft/types/errors.go +++ b/modules/nft/types/errors.go @@ -16,8 +16,9 @@ var ( ErrInvalidTokenID = sdkerrors.Register(ModuleName, 17, "invalid nft id") ErrInvalidTokenURI = sdkerrors.Register(ModuleName, 18, "invalid nft uri") - // Rental Plugin Errors - ErrRentalOption = sdkerrors.Register(ModuleName, 31, "rental is disabled") - ErrInvalidExpiry = sdkerrors.Register(ModuleName, 32, "invalid expiry") - ErrNotExistentRentalInfo = sdkerrors.Register(ModuleName, 33, "rental info is not existent") + // Rental Plugin errors + ErrRentalPluginNotExistent = sdkerrors.Register(ModuleName, 30, "rental plugin is not existent") + ErrRentalPluginDisabled = sdkerrors.Register(ModuleName, 31, "rental plugin is disabled") + ErrRentalExpiryInvalid = sdkerrors.Register(ModuleName, 32, "rental expiry is invalid") + ErrRentalInfoNotExsitent = sdkerrors.Register(ModuleName, 33, "rental info is not existent") ) diff --git a/modules/nft/types/nft.pb.go b/modules/nft/types/nft.pb.go index 15339866..e307e0f6 100644 --- a/modules/nft/types/nft.pb.go +++ b/modules/nft/types/nft.pb.go @@ -192,6 +192,46 @@ func (m *Denom) XXX_DiscardUnknown() { var xxx_messageInfo_Denom proto.InternalMessageInfo +// The message is an intermediate struct for composing user data and plugin +// config +type DenomComposedData struct { + UserData string `protobuf:"bytes,1,opt,name=userData,proto3" json:"userData,omitempty"` + DenomPlugin *DenomPlugin `protobuf:"bytes,2,opt,name=denomPlugin,proto3" json:"denomPlugin,omitempty"` +} + +func (m *DenomComposedData) Reset() { *m = DenomComposedData{} } +func (m *DenomComposedData) String() string { return proto.CompactTextString(m) } +func (*DenomComposedData) ProtoMessage() {} +func (*DenomComposedData) Descriptor() ([]byte, []int) { + return fileDescriptor_fe8ab7e15b7f0646, []int{4} +} +func (m *DenomComposedData) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DenomComposedData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DenomComposedData.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 *DenomComposedData) XXX_Merge(src proto.Message) { + xxx_messageInfo_DenomComposedData.Merge(m, src) +} +func (m *DenomComposedData) XXX_Size() int { + return m.Size() +} +func (m *DenomComposedData) XXX_DiscardUnknown() { + xxx_messageInfo_DenomComposedData.DiscardUnknown(m) +} + +var xxx_messageInfo_DenomComposedData proto.InternalMessageInfo + type DenomPlugin struct { // RoyaltyPlugin royaltyPlugin = 1 [] ; RentalPlugin *RentalPlugin `protobuf:"bytes,2,opt,name=rentalPlugin,proto3" json:"irismod:4907"` @@ -201,7 +241,7 @@ func (m *DenomPlugin) Reset() { *m = DenomPlugin{} } func (m *DenomPlugin) String() string { return proto.CompactTextString(m) } func (*DenomPlugin) ProtoMessage() {} func (*DenomPlugin) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{4} + return fileDescriptor_fe8ab7e15b7f0646, []int{5} } func (m *DenomPlugin) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -244,7 +284,7 @@ func (m *DenomMetadata) Reset() { *m = DenomMetadata{} } func (m *DenomMetadata) String() string { return proto.CompactTextString(m) } func (*DenomMetadata) ProtoMessage() {} func (*DenomMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{5} + return fileDescriptor_fe8ab7e15b7f0646, []int{6} } func (m *DenomMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -283,7 +323,7 @@ func (m *IDCollection) Reset() { *m = IDCollection{} } func (m *IDCollection) String() string { return proto.CompactTextString(m) } func (*IDCollection) ProtoMessage() {} func (*IDCollection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{6} + return fileDescriptor_fe8ab7e15b7f0646, []int{7} } func (m *IDCollection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -322,7 +362,7 @@ func (m *Owner) Reset() { *m = Owner{} } func (m *Owner) String() string { return proto.CompactTextString(m) } func (*Owner) ProtoMessage() {} func (*Owner) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{7} + return fileDescriptor_fe8ab7e15b7f0646, []int{8} } func (m *Owner) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -361,7 +401,7 @@ func (m *Collection) Reset() { *m = Collection{} } func (m *Collection) String() string { return proto.CompactTextString(m) } func (*Collection) ProtoMessage() {} func (*Collection) Descriptor() ([]byte, []int) { - return fileDescriptor_fe8ab7e15b7f0646, []int{8} + return fileDescriptor_fe8ab7e15b7f0646, []int{9} } func (m *Collection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -395,6 +435,7 @@ func init() { proto.RegisterType((*PluginInfo)(nil), "irismod.nft.PluginInfo") proto.RegisterType((*NFTMetadata)(nil), "irismod.nft.NFTMetadata") proto.RegisterType((*Denom)(nil), "irismod.nft.Denom") + proto.RegisterType((*DenomComposedData)(nil), "irismod.nft.DenomComposedData") proto.RegisterType((*DenomPlugin)(nil), "irismod.nft.DenomPlugin") proto.RegisterType((*DenomMetadata)(nil), "irismod.nft.DenomMetadata") proto.RegisterType((*IDCollection)(nil), "irismod.nft.IDCollection") @@ -405,53 +446,56 @@ func init() { func init() { proto.RegisterFile("nft/nft.proto", fileDescriptor_fe8ab7e15b7f0646) } var fileDescriptor_fe8ab7e15b7f0646 = []byte{ - // 735 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4d, 0x6f, 0xd3, 0x48, - 0x18, 0x8e, 0x1d, 0xa7, 0x4e, 0x5e, 0x27, 0x6d, 0x76, 0x36, 0xda, 0x75, 0x7b, 0x88, 0x2b, 0x6b, - 0xa5, 0xad, 0xb4, 0xab, 0x04, 0x0a, 0x02, 0xd1, 0xa3, 0xa9, 0x2a, 0x82, 0x44, 0x8b, 0xac, 0x22, - 0x24, 0x0e, 0x44, 0xae, 0x67, 0x92, 0x8c, 0x88, 0xed, 0xc8, 0x33, 0x51, 0x55, 0x8e, 0x1c, 0xb8, - 0x82, 0xc4, 0x1f, 0xe0, 0x47, 0xf0, 0x23, 0x7a, 0xec, 0x91, 0x53, 0x04, 0xe9, 0x05, 0x71, 0xec, - 0x2f, 0x40, 0x9e, 0x19, 0x07, 0xa7, 0x14, 0xa9, 0x52, 0x6f, 0xf3, 0x7e, 0x8c, 0xdf, 0xe7, 0x79, - 0xde, 0x47, 0x63, 0x68, 0xc4, 0x03, 0xde, 0x8d, 0x07, 0xbc, 0x33, 0x49, 0x13, 0x9e, 0x20, 0x8b, - 0xa6, 0x94, 0x45, 0x09, 0xee, 0xc4, 0x03, 0xbe, 0xd1, 0x1a, 0x26, 0xc3, 0x44, 0xe4, 0xbb, 0xd9, - 0x49, 0xb6, 0x6c, 0x34, 0xb3, 0x1b, 0x29, 0x89, 0x79, 0x30, 0x96, 0x19, 0xf7, 0x83, 0x06, 0xa6, - 0x17, 0x30, 0xb2, 0xbf, 0x77, 0x88, 0x56, 0x41, 0xa7, 0xd8, 0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57, 0x7d, 0xbf, 0x1b, - 0x25, 0x78, 0x3a, 0x26, 0x2c, 0xfb, 0x37, 0x74, 0xf9, 0xc9, 0x84, 0xb0, 0xa3, 0x15, 0xf1, 0xda, - 0xdf, 0xf9, 0x11, 0x00, 0x00, 0xff, 0xff, 0x48, 0x8f, 0xbe, 0x63, 0x33, 0x06, 0x00, 0x00, + // 774 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x4f, 0x6f, 0xe3, 0x44, + 0x14, 0x8f, 0x1d, 0xa7, 0x4e, 0x9e, 0x93, 0x6e, 0x76, 0x88, 0xc0, 0xed, 0x21, 0xae, 0x2c, 0x24, + 0x56, 0x02, 0x25, 0xb0, 0x20, 0x10, 0x39, 0x7a, 0xa3, 0x8a, 0x20, 0xd1, 0x45, 0x56, 0x11, 0x12, + 0x07, 0x22, 0xd7, 0x33, 0x49, 0x46, 0x1b, 0x7b, 0x22, 0xcf, 0x58, 0xab, 0x72, 0xe4, 0xc0, 0x15, + 0x24, 0xbe, 0x00, 0x1f, 0x82, 0x0f, 0xd1, 0xe3, 0x1e, 0x39, 0x45, 0x90, 0x5e, 0x10, 0xc7, 0x7e, + 0x02, 0xe4, 0x99, 0x71, 0xd6, 0xde, 0x76, 0xa5, 0x4a, 0xbd, 0xbd, 0x7f, 0x33, 0xef, 0xf7, 0xde, + 0xef, 0x67, 0x0f, 0xf4, 0xd2, 0x85, 0x18, 0xa7, 0x0b, 0x31, 0xda, 0x64, 0x4c, 0x30, 0xe4, 0xd0, + 0x8c, 0xf2, 0x84, 0xe1, 0x51, 0xba, 0x10, 0xc7, 0x83, 0x25, 0x5b, 0x32, 0x19, 0x1f, 0x17, 0x96, + 0x2a, 0x39, 0xee, 0x17, 0x27, 0x32, 0x92, 0x8a, 0x68, 0xad, 0x22, 0xfe, 0xef, 0x06, 0xd8, 0x41, + 0xc4, 0xc9, 0xd9, 0xe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59, 0xaf, 0x7a, 0x07, 0x5f, 0x5f, 0xfd, 0x33, 0x6c, 0x5c, 0xed, 0x86, + 0xc6, 0xab, 0xdd, 0xd0, 0xf8, 0x7b, 0x37, 0x34, 0x7e, 0xbb, 0x1e, 0x36, 0x5e, 0x5d, 0x0f, 0x1b, + 0x7f, 0x5d, 0x0f, 0x1b, 0x3f, 0x7c, 0xb4, 0xa4, 0x62, 0x95, 0x5f, 0x8c, 0x62, 0x96, 0x8c, 0x8b, + 0x7b, 0x53, 0x22, 0xc6, 0xfa, 0xfe, 0x71, 0xc2, 0x70, 0xbe, 0x26, 0xbc, 0x78, 0x88, 0xc6, 0xe2, + 0x72, 0x43, 0xf8, 0xc5, 0x81, 0x7c, 0x5a, 0x3e, 0xfd, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x9f, + 0x93, 0xeb, 0xa0, 0x06, 0x00, 0x00, } func (this *BaseNFT) Equal(that interface{}) bool { @@ -967,6 +1011,48 @@ func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DenomComposedData) 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 *DenomComposedData) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DenomComposedData) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DenomPlugin != nil { + { + size, err := m.DenomPlugin.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintNft(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.UserData) > 0 { + i -= len(m.UserData) + copy(dAtA[i:], m.UserData) + i = encodeVarintNft(dAtA, i, uint64(len(m.UserData))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *DenomPlugin) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1337,6 +1423,23 @@ func (m *Denom) Size() (n int) { return n } +func (m *DenomComposedData) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.UserData) + if l > 0 { + n += 1 + l + sovNft(uint64(l)) + } + if m.DenomPlugin != nil { + l = m.DenomPlugin.Size() + n += 1 + l + sovNft(uint64(l)) + } + return n +} + func (m *DenomPlugin) Size() (n int) { if m == nil { return 0 @@ -2298,6 +2401,124 @@ func (m *Denom) Unmarshal(dAtA []byte) error { } return nil } +func (m *DenomComposedData) 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 ErrIntOverflowNft + } + 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: DenomComposedData: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DenomComposedData: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field UserData", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + 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 ErrInvalidLengthNft + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.UserData = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DenomPlugin", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowNft + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthNft + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthNft + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DenomPlugin == nil { + m.DenomPlugin = &DenomPlugin{} + } + if err := m.DenomPlugin.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipNft(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthNft + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *DenomPlugin) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/modules/nft/types/rental.pb.go b/modules/nft/types/rental.pb.go index fb3ba1b4..a0aef9ba 100644 --- a/modules/nft/types/rental.pb.go +++ b/modules/nft/types/rental.pb.go @@ -23,9 +23,9 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// RentalPlugin defines the message for a denom rental plugin config +// RentalPlugin is denom-level rental config type RentalPlugin struct { - Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"irismod:4907:enabled"` } func (m *RentalPlugin) Reset() { *m = RentalPlugin{} } @@ -68,10 +68,10 @@ func (m *RentalPlugin) GetEnabled() bool { return false } -// RentalInfo defines the message for an nft rental info +// RentalInfo is token-level rental info type RentalInfo struct { - User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` - Expires int64 `protobuf:"varint,2,opt,name=expires,proto3" json:"expires,omitempty"` + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"irismod:4907:user"` + Expiry int64 `protobuf:"varint,2,opt,name=expiry,proto3" json:"irismod:4907:expiry"` } func (m *RentalInfo) Reset() { *m = RentalInfo{} } @@ -114,9 +114,9 @@ func (m *RentalInfo) GetUser() string { return "" } -func (m *RentalInfo) GetExpires() int64 { +func (m *RentalInfo) GetExpiry() int64 { if m != nil { - return m.Expires + return m.Expiry } return 0 } @@ -129,21 +129,24 @@ func init() { func init() { proto.RegisterFile("nft/rental.proto", fileDescriptor_e57beeaf512eaaa2) } var fileDescriptor_e57beeaf512eaaa2 = []byte{ - // 220 bytes of a gzipped FileDescriptorProto + // 260 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xc8, 0x4b, 0x2b, 0xd1, 0x2f, 0x4a, 0xcd, 0x2b, 0x49, 0xcc, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xce, 0x2c, 0xca, 0x2c, 0xce, 0xcd, 0x4f, 0xd1, 0xcb, 0x4b, 0x2b, 0x91, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, - 0x8b, 0xeb, 0x83, 0x58, 0x10, 0x25, 0x4a, 0x7a, 0x5c, 0x3c, 0x41, 0x60, 0x2d, 0x01, 0x39, 0xa5, - 0xe9, 0x99, 0x79, 0x42, 0x12, 0x5c, 0xec, 0xa9, 0x79, 0x89, 0x49, 0x39, 0xa9, 0x29, 0x12, 0x8c, - 0x0a, 0x8c, 0x1a, 0x1c, 0x41, 0x30, 0xae, 0x15, 0xcb, 0x8b, 0x05, 0xf2, 0x8c, 0x4a, 0x0e, 0x5c, - 0x5c, 0x10, 0xf5, 0x9e, 0x79, 0x69, 0xf9, 0x42, 0x42, 0x5c, 0x2c, 0xa5, 0xc5, 0xa9, 0x45, 0x60, - 0xa5, 0x9c, 0x41, 0x60, 0x36, 0xd8, 0x84, 0x8a, 0x82, 0xcc, 0xa2, 0xd4, 0x62, 0x09, 0x26, 0x05, - 0x46, 0x0d, 0xe6, 0x20, 0x18, 0x17, 0x62, 0x82, 0x93, 0xdb, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, - 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, - 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, - 0x83, 0x5c, 0x9e, 0x97, 0x5a, 0xa2, 0x0f, 0xf5, 0x81, 0x7e, 0x6e, 0x7e, 0x4a, 0x69, 0x4e, 0x6a, - 0xb1, 0x3e, 0xc8, 0x8f, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x0f, 0x18, 0x03, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x71, 0xc4, 0xc4, 0x34, 0xf7, 0x00, 0x00, 0x00, + 0x8b, 0xeb, 0x83, 0x58, 0x10, 0x25, 0x4a, 0x1e, 0x5c, 0x3c, 0x41, 0x60, 0x2d, 0x01, 0x39, 0xa5, + 0xe9, 0x99, 0x79, 0x42, 0x46, 0x5c, 0xec, 0xa9, 0x79, 0x89, 0x49, 0x39, 0xa9, 0x29, 0x12, 0x8c, + 0x0a, 0x8c, 0x1a, 0x1c, 0x4e, 0x12, 0xaf, 0xee, 0xc9, 0x8b, 0x40, 0xcd, 0xb1, 0x32, 0xb1, 0x34, + 0x30, 0xb7, 0x82, 0xca, 0x07, 0xc1, 0x14, 0x5a, 0xb1, 0xbc, 0x58, 0x20, 0xcf, 0xa8, 0x94, 0xc7, + 0xc5, 0x05, 0x31, 0xc9, 0x33, 0x2f, 0x2d, 0x5f, 0x48, 0x93, 0x8b, 0xa5, 0xb4, 0x38, 0xb5, 0x08, + 0x6c, 0x08, 0xa7, 0x93, 0xe8, 0xab, 0x7b, 0xf2, 0x82, 0x28, 0x86, 0x80, 0x24, 0x83, 0xc0, 0x4a, + 0x84, 0xf4, 0xb9, 0xd8, 0x52, 0x2b, 0x0a, 0x32, 0x8b, 0x2a, 0x25, 0x98, 0x14, 0x18, 0x35, 0x98, + 0x9d, 0xc4, 0x5f, 0xdd, 0x93, 0x17, 0x46, 0xb5, 0x11, 0x2c, 0x1d, 0x04, 0x55, 0x06, 0xb1, 0xcf, + 0xc9, 0xed, 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, 0x74, 0xd2, 0x33, 0x4b, + 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x41, 0xe6, 0xe4, 0xa5, 0x96, 0xe8, 0x43, 0xcd, + 0xd3, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x2d, 0xd6, 0x07, 0x85, 0x55, 0x49, 0x65, 0x41, 0x6a, + 0x71, 0x12, 0x1b, 0x38, 0x20, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x66, 0xc0, 0x43, 0x4e, + 0x3f, 0x01, 0x00, 0x00, } func (this *RentalPlugin) Equal(that interface{}) bool { @@ -192,7 +195,7 @@ func (this *RentalInfo) Equal(that interface{}) bool { if this.User != that1.User { return false } - if this.Expires != that1.Expires { + if this.Expiry != that1.Expiry { return false } return true @@ -250,8 +253,8 @@ func (m *RentalInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Expires != 0 { - i = encodeVarintRental(dAtA, i, uint64(m.Expires)) + if m.Expiry != 0 { + i = encodeVarintRental(dAtA, i, uint64(m.Expiry)) i-- dAtA[i] = 0x10 } @@ -298,8 +301,8 @@ func (m *RentalInfo) Size() (n int) { if l > 0 { n += 1 + l + sovRental(uint64(l)) } - if m.Expires != 0 { - n += 1 + sovRental(uint64(m.Expires)) + if m.Expiry != 0 { + n += 1 + sovRental(uint64(m.Expiry)) } return n } @@ -443,9 +446,9 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType) } - m.Expires = 0 + m.Expiry = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRental @@ -455,7 +458,7 @@ func (m *RentalInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Expires |= int64(b&0x7F) << shift + m.Expiry |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/nft/nft.proto b/proto/nft/nft.proto index e55469bf..30d27ef7 100644 --- a/proto/nft/nft.proto +++ b/proto/nft/nft.proto @@ -50,6 +50,13 @@ message Denom { string data = 11; } +// The message is an intermediate struct for composing user data and plugin +// config +message DenomComposedData { + string userData = 1; + DenomPlugin denomPlugin = 2; +} + message DenomPlugin { // RoyaltyPlugin royaltyPlugin = 1 [] ; RentalPlugin rentalPlugin = 2 [ (gogoproto.jsontag) = "irismod:4907" ]; diff --git a/proto/nft/rental.proto b/proto/nft/rental.proto index 7b0cdef6..ee28f069 100644 --- a/proto/nft/rental.proto +++ b/proto/nft/rental.proto @@ -5,17 +5,17 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/irisnet/irismod/modules/nft/types"; -// RentalPlugin defines the message for a denom rental plugin config +// RentalPlugin is denom-level rental config message RentalPlugin { option (gogoproto.equal) = true; - bool enabled = 1; + bool enabled = 1 [ (gogoproto.jsontag) = "irismod:4907:enabled" ]; } -// RentalInfo defines the message for an nft rental info +// RentalInfo is token-level rental info message RentalInfo { option (gogoproto.equal) = true; - string user = 1; - int64 expires = 2; + string user = 1 [ (gogoproto.jsontag) = "irismod:4907:user" ]; + int64 expiry = 2 [ (gogoproto.jsontag) = "irismod:4907:expiry" ]; } \ No newline at end of file From 4149361398f8f9df242a6c7ebf4a4b7a65680848 Mon Sep 17 00:00:00 2001 From: yuandu Date: Thu, 22 Dec 2022 18:55:59 +0800 Subject: [PATCH 20/20] add cli --- modules/nft/client/cli/flags.go | 9 + modules/nft/client/cli/query.go | 1 + modules/nft/client/cli/rental.go | 188 ++++++++++++++++++ modules/nft/client/cli/rental_test.go | 104 ++++++++++ modules/nft/client/cli/tx.go | 9 +- modules/nft/client/cli/util.go | 50 +++++ modules/nft/client/testutil/rental_helpers.go | 51 +++++ modules/nft/keeper/grpc_query.go | 2 +- modules/nft/keeper/msg_server.go | 4 +- modules/nft/keeper/rental_test.go | 2 +- modules/nft/keeper/{utils.go => util.go} | 0 .../keeper/{utils_test.go => util_test.go} | 0 modules/nft/types/msgs.go | 4 +- modules/nft/types/query.pb.go | 146 +++++++------- modules/nft/types/tx.pb.go | 110 +++++----- proto/nft/query.proto | 2 +- proto/nft/tx.proto | 2 +- 17 files changed, 547 insertions(+), 137 deletions(-) create mode 100644 modules/nft/client/cli/rental.go create mode 100644 modules/nft/client/cli/rental_test.go create mode 100644 modules/nft/client/cli/util.go create mode 100644 modules/nft/client/testutil/rental_helpers.go rename modules/nft/keeper/{utils.go => util.go} (100%) rename modules/nft/keeper/{utils_test.go => util_test.go} (100%) diff --git a/modules/nft/client/cli/flags.go b/modules/nft/client/cli/flags.go index f7657394..92ef1fb9 100644 --- a/modules/nft/client/cli/flags.go +++ b/modules/nft/client/cli/flags.go @@ -19,6 +19,10 @@ const ( FlagSymbol = "symbol" FlagMintRestricted = "mint-restricted" FlagUpdateRestricted = "update-restricted" + + FlagRentable = "rentable" + FlagRentalExpiry = "expiry" + FlagRentalUser = "user" ) var ( @@ -29,6 +33,7 @@ var ( FsQuerySupply = flag.NewFlagSet("", flag.ContinueOnError) FsQueryOwner = flag.NewFlagSet("", flag.ContinueOnError) FsTransferDenom = flag.NewFlagSet("", flag.ContinueOnError) + FsRental = flag.NewFlagSet("", flag.ContinueOnError) ) func init() { @@ -41,6 +46,7 @@ func init() { FsIssueDenom.String(FlagData, "", "The data is the app specific metadata of the NFT class. Optional") FsIssueDenom.Bool(FlagMintRestricted, false, "mint restricted of nft under denom") FsIssueDenom.Bool(FlagUpdateRestricted, false, "update restricted of nft under denom") + FsIssueDenom.Bool(FlagRentable, false, "rental plugin enable option") FsMintNFT.String(FlagURI, "", "The uri for supplemental off-chain tokenData (should return a JSON object)") FsMintNFT.String(FlagURIHash, "", "The uri_hash is a hash of the document pointed by uri. Optional") @@ -61,4 +67,7 @@ func init() { FsQuerySupply.String(FlagOwner, "", "The owner of the nft") FsQueryOwner.String(FlagDenomID, "", "The name of the collection") + + FsRental.String(FlagRentalUser, "", "The user of the rented nft") + FsRental.Int64(FlagRentalExpiry, 0, "The expiry of the rented nft") } diff --git a/modules/nft/client/cli/query.go b/modules/nft/client/cli/query.go index d7627c73..fb979df5 100644 --- a/modules/nft/client/cli/query.go +++ b/modules/nft/client/cli/query.go @@ -29,6 +29,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQuerySupply(), GetCmdQueryOwner(), GetCmdQueryNFT(), + GetCmdQueryRental(), ) return queryCmd diff --git a/modules/nft/client/cli/rental.go b/modules/nft/client/cli/rental.go new file mode 100644 index 00000000..125937f3 --- /dev/null +++ b/modules/nft/client/cli/rental.go @@ -0,0 +1,188 @@ +package cli + +import ( + "context" + "fmt" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/version" + "github.com/irisnet/irismod/modules/nft/types" + "github.com/spf13/cobra" +) + +// Tx Command for rental plugin + +// GetCmdRental is the CLI tx command for NFT rental plugin. +func GetCmdRental() *cobra.Command { + cmd := &cobra.Command{ + Use: "rental", + Long: "NFT rental plugin tx subcommands", + DisableFlagParsing: true, + Run: func(cmd *cobra.Command, args []string) {}, + } + + cmd.AddCommand( + GetCmdRentalSetUser(), + ) + + return cmd +} + +// GetCmdRentalSetUser is the CLI command for setting user for a rentable NFT. +func GetCmdRentalSetUser() *cobra.Command { + cmd := &cobra.Command{ + Use: "set-user [denom-id] [nft-id]", + Long: "Set user and expiry for an NFT.", + Example: fmt.Sprintf( + "$ %s tx nft rental set-user "+ + "--user= "+ + "--expiry= "+ + "--from= "+ + "--chain-id= "+ + "--fees=", + version.AppName), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + sender := clientCtx.GetFromAddress().String() + + user, err := cmd.Flags().GetString(FlagRentalUser) + if err != nil { + return err + } + + expiry, err := cmd.Flags().GetInt64(FlagRentalExpiry) + if err != nil { + return err + } + + msg := types.NewMsgSetUser( + args[0], + args[1], + user, + expiry, + sender, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + cmd.Flags().AddFlagSet(FsRental) + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +// Query Command for rental plugin + +// GetCmdQueryRental is the CLI query command for NFT rental plugin. +func GetCmdQueryRental() *cobra.Command { + cmd := &cobra.Command{ + Use: "rental", + Long: "NFT rental plugin query subcommands", + DisableFlagParsing: true, + Run: func(cmd *cobra.Command, args []string) {}, + } + + cmd.AddCommand( + GetCmdQueryRentalUserOf(), + GetCmdQueryRentalUserExpires(), + GetCmdQueryRentalHasUser(), + ) + + return cmd +} + +// GetCmdQueryRentalUserOf is the CLI command for query user of a rentable NFT. +func GetCmdQueryRentalUserOf() *cobra.Command { + cmd := &cobra.Command{ + Use: "user [denom-id] [nft-id]", + Long: "user of a rented nft", + Example: fmt.Sprintf("$ %s query nft rental user ", version.AppName), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.UserOf(context.Background(), &types.QueryUserOfRequest{ + DenomId: args[0], + NftId: args[1], + }) + if err != nil { + return err + } + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdQueryRentalUserExpires is the CLI command for query expiry of a rentable NFT. +func GetCmdQueryRentalUserExpires() *cobra.Command { + cmd := &cobra.Command{ + Use: "user [denom-id] [nft-id]", + Long: "expiry of a rented nft", + Example: fmt.Sprintf("$ %s query nft rental user ", version.AppName), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.UserExpires(context.Background(), &types.QueryUserExpiresRequest{ + DenomId: args[0], + NftId: args[1], + }) + if err != nil { + return err + } + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +// GetCmdQueryRentalHasUser is the CLI command for query does an NFT have a user. +func GetCmdQueryRentalHasUser() *cobra.Command { + cmd := &cobra.Command{ + Use: "user [denom-id] [nft-id]", + Long: "does an nft have a user", + Example: fmt.Sprintf("$ %s query nft rental user ", version.AppName), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + resp, err := queryClient.HasUser(context.Background(), &types.QueryHasUserRequest{ + DenomId: args[0], + NftId: args[1], + }) + if err != nil { + return err + } + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/modules/nft/client/cli/rental_test.go b/modules/nft/client/cli/rental_test.go new file mode 100644 index 00000000..c4326643 --- /dev/null +++ b/modules/nft/client/cli/rental_test.go @@ -0,0 +1,104 @@ +package cli_test + +// +//import ( +// "fmt" +// +// "github.com/cosmos/cosmos-sdk/client/flags" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/gogo/protobuf/proto" +// "github.com/irisnet/irismod/modules/nft/client/cli" +// "github.com/irisnet/irismod/modules/nft/client/testutil" +//) +// +//func (s *IntegrationTestSuite) TestRental() { +// owner := s.network.Validators[0] +// user := s.network.Validators[1] +// +// // 1. issue a denom with rental enabled. +// denomID := "denom" +// denomName := "denomName" +// denomSchema := "denomSchema" +// denomSymbol := "dsb" +// mintRestricted := false +// updateRestricted := true +// denomDescription := "denom description" +// denomURI := "denomURI" +// denomURIHash := "denomURIHash" +// denomData := "denomData" +// rentable := true +// +// args := []string{ +// fmt.Sprintf("--%s=%s", cli.FlagDenomName, denomName), +// fmt.Sprintf("--%s=%s", cli.FlagSchema, denomSchema), +// fmt.Sprintf("--%s=%s", cli.FlagSymbol, denomSymbol), +// fmt.Sprintf("--%s=%s", cli.FlagURI, denomURI), +// fmt.Sprintf("--%s=%s", cli.FlagURIHash, denomURIHash), +// fmt.Sprintf("--%s=%s", cli.FlagDescription, denomDescription), +// fmt.Sprintf("--%s=%s", cli.FlagData, denomData), +// fmt.Sprintf("--%s=%t", cli.FlagMintRestricted, mintRestricted), +// fmt.Sprintf("--%s=%t", cli.FlagUpdateRestricted, updateRestricted), +// fmt.Sprintf("--%s=%t", cli.FlagRentable, rentable), +// +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), +// } +// +// respType := proto.Message(&sdk.TxResponse{}) +// expectedCode := uint32(0) +// +// bz, err := testutil.IssueDenomExec(owner.ClientCtx, owner.Address.String(), denomID, args...) +// s.Require().NoError(err) +// s.Require().NoError(owner.ClientCtx.Codec.UnmarshalJSON(bz.Bytes(), respType), bz.String()) +// txResp := respType.(*sdk.TxResponse) +// s.Require().Equal(expectedCode, txResp.Code) +// +// // 2. mint an nft +// tokenID := "token" +// tokenName := "tokenName" +// tokenURI := "tokenURI" +// tokenURIHash := "tokenURIHash" +// tokenData := "tokenData" +// +// args = []string{ +// fmt.Sprintf("--%s=%s", cli.FlagData, tokenData), +// fmt.Sprintf("--%s=%s", cli.FlagRecipient, owner.Address.String()), +// fmt.Sprintf("--%s=%s", cli.FlagURI, tokenURI), +// fmt.Sprintf("--%s=%s", cli.FlagURIHash, tokenURIHash), +// fmt.Sprintf("--%s=%s", cli.FlagTokenName, tokenName), +// +// fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), +// fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), +// fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()), +// } +// +// respType = proto.Message(&sdk.TxResponse{}) +// +// bz, err = testutil.MintNFTExec(owner.ClientCtx, owner.Address.String(), denomID, tokenID, args...) +// s.Require().NoError(err) +// s.Require().NoError(owner.ClientCtx.Codec.UnmarshalJSON(bz.Bytes(), respType), bz.String()) +// txResp = respType.(*sdk.TxResponse) +// s.Require().Equal(expectedCode, txResp.Code) +// +// // 3. set user for that nft +// +// expiry := "2524579200" // 2050-01-01-00:00:00 +// +// args = []string{ +// fmt.Sprintf("--%s=%s", cli.FlagRentalUser, user.Address.String()), +// fmt.Sprintf("--%s=%s", cli.FlagRentalExpiry, expiry), +// } +// +// respType = proto.Message(&sdk.TxResponse{}) +// +// bz, err = testutil.RentalSetUser(owner.ClientCtx, owner.Address.String(), denomID, tokenID, args...) +// //s.Require().NoError(err) +// // s.Require().NoError(owner.ClientCtx.Codec.UnmarshalJSON(bz.Bytes(), respType), bz.String()) +// owner.ClientCtx.Codec.UnmarshalJSON(bz.Bytes(), respType) +// fmt.Print(respType) +// //txResp = respType.(*sdk.TxResponse) +// //s.Require().Equal(expectedCode, txResp.Code) +// +// // 4. get rental info +//} diff --git a/modules/nft/client/cli/tx.go b/modules/nft/client/cli/tx.go index 1e3a2c26..a2dc6c32 100644 --- a/modules/nft/client/cli/tx.go +++ b/modules/nft/client/cli/tx.go @@ -33,6 +33,7 @@ func NewTxCmd() *cobra.Command { GetCmdTransferNFT(), GetCmdBurnNFT(), GetCmdTransferDenom(), + GetCmdRental(), ) return txCmd @@ -107,6 +108,12 @@ func GetCmdIssueDenom() *cobra.Command { schema = string(optionsContent) } + // compose plugin config and user data + composeData, err := composeDenomData(cmd, data) + if err != nil { + return err + } + msg := types.NewMsgIssueDenom( args[0], denomName, @@ -118,7 +125,7 @@ func GetCmdIssueDenom() *cobra.Command { description, uri, uriHash, - data, + composeData, ) if err := msg.ValidateBasic(); err != nil { return err diff --git a/modules/nft/client/cli/util.go b/modules/nft/client/cli/util.go new file mode 100644 index 00000000..1f7234a2 --- /dev/null +++ b/modules/nft/client/cli/util.go @@ -0,0 +1,50 @@ +package cli + +import ( + "encoding/json" + "github.com/irisnet/irismod/modules/nft/types" + "github.com/spf13/cobra" +) + +// composeDenomData composes an json string from denomPlugin and user data +func composeDenomData(cmd *cobra.Command, data string) (string, error) { + denomPlugin, err := composeDenomPlugin(cmd) + if err != nil { + return data, err + } + + composedData := types.DenomComposedData{ + UserData: data, + DenomPlugin: denomPlugin, + } + + bz, err := json.Marshal(composedData) + if err != nil { + return data, err + } + + return string(bz), nil +} + +// composeDenomPlugin compose DenomPlugin from cli flag +func composeDenomPlugin(cmd *cobra.Command) (*types.DenomPlugin, error) { + rentalPlugin, err := composeRentalPlugin(cmd) + if err != nil { + return nil, err + } + + return &types.DenomPlugin{ + RentalPlugin: rentalPlugin, + }, nil +} + +// composeRentalPlugin compose RentalPlugin from cli flag +func composeRentalPlugin(cmd *cobra.Command) (*types.RentalPlugin, error) { + rental, err := cmd.Flags().GetBool(FlagRentable) + if err != nil { + return nil, err + } + return &types.RentalPlugin{ + Enabled: rental, + }, nil +} diff --git a/modules/nft/client/testutil/rental_helpers.go b/modules/nft/client/testutil/rental_helpers.go new file mode 100644 index 00000000..e2f646a8 --- /dev/null +++ b/modules/nft/client/testutil/rental_helpers.go @@ -0,0 +1,51 @@ +package testutil + +import ( + "fmt" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/testutil" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/irisnet/irismod/modules/nft/client/cli" +) + +func RentalSetUser(clientCtx client.Context, from string, denom, token string, extraArgs ...string) (testutil.BufferWriter, error) { + args := []string{ + denom, + token, + fmt.Sprintf("--%s=%s", flags.FlagFrom, from), + } + args = append(args, extraArgs...) + + return clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdRentalSetUser(), args) +} + +func QueryRentalUserOf(clientCtx client.Context, denom, token string, extraArgs ...string) (testutil.BufferWriter, error) { + args := []string{ + denom, + token, + } + args = append(args, extraArgs...) + + return clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryRentalUserOf(), args) +} + +func QueryRentalUserExpires(clientCtx client.Context, denom, token string, extraArgs ...string) (testutil.BufferWriter, error) { + args := []string{ + denom, + token, + } + args = append(args, extraArgs...) + + return clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryRentalUserExpires(), args) +} + +func QueryRentalHasUser(clientCtx client.Context, denom, token string, extraArgs ...string) (testutil.BufferWriter, error) { + args := []string{ + denom, + token, + } + args = append(args, extraArgs...) + + return clitestutil.ExecTestCLICmd(clientCtx, cli.GetCmdQueryRentalHasUser(), args) +} \ No newline at end of file diff --git a/modules/nft/keeper/grpc_query.go b/modules/nft/keeper/grpc_query.go index d4676bf7..75c8c28f 100644 --- a/modules/nft/keeper/grpc_query.go +++ b/modules/nft/keeper/grpc_query.go @@ -209,7 +209,7 @@ func (k Keeper) UserExpires(goCtx context.Context, msg *types.QueryUserExpiresRe return nil, err } - return &types.QueryUserExpiresResponse{Expires: rental.Expiry}, nil + return &types.QueryUserExpiresResponse{Expiry: rental.Expiry}, nil } // HasUser queries if an nft has the user diff --git a/modules/nft/keeper/msg_server.go b/modules/nft/keeper/msg_server.go index 96b95783..36b46ae9 100644 --- a/modules/nft/keeper/msg_server.go +++ b/modules/nft/keeper/msg_server.go @@ -272,7 +272,7 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms if err := k.Rent(ctx, msg.DenomId, msg.NftId, types.RentalInfo{ User: user.String(), - Expiry: msg.Expires, + Expiry: msg.Expiry, }); err != nil { return nil, err } @@ -282,7 +282,7 @@ func (k Keeper) SetUser(goCtx context.Context, msg *types.MsgSetUser) (*types.Ms types.EventTypeSetUser, sdk.NewAttribute(types.AttributeKeyDenomID, msg.DenomId), sdk.NewAttribute(types.AttributeKeyTokenID, msg.NftId), - sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatInt(msg.Expires, 10)), + sdk.NewAttribute(types.AttributeKeyExpires, strconv.FormatInt(msg.Expiry, 10)), sdk.NewAttribute(types.AttributeKeyUser, msg.User), ), sdk.NewEvent( diff --git a/modules/nft/keeper/rental_test.go b/modules/nft/keeper/rental_test.go index 4c786cc8..c7a52e18 100644 --- a/modules/nft/keeper/rental_test.go +++ b/modules/nft/keeper/rental_test.go @@ -176,7 +176,7 @@ func (suite *KeeperSuite) TestUserExpires() { NftId: rentalNftId, }) suite.NoError(err) - suite.Equal(expiry, resp.Expires) + suite.Equal(expiry, resp.Expiry) } func (suite *KeeperSuite) TestHasUser() { diff --git a/modules/nft/keeper/utils.go b/modules/nft/keeper/util.go similarity index 100% rename from modules/nft/keeper/utils.go rename to modules/nft/keeper/util.go diff --git a/modules/nft/keeper/utils_test.go b/modules/nft/keeper/util_test.go similarity index 100% rename from modules/nft/keeper/utils_test.go rename to modules/nft/keeper/util_test.go diff --git a/modules/nft/types/msgs.go b/modules/nft/types/msgs.go index e2494a7e..fb07f696 100644 --- a/modules/nft/types/msgs.go +++ b/modules/nft/types/msgs.go @@ -330,12 +330,12 @@ func (msg MsgTransferDenom) GetSigners() []sdk.AccAddress { } func NewMsgSetUser(denomId, nftId, user string, - expires int64, sender string) *MsgSetUser { + expiry int64, sender string) *MsgSetUser { return &MsgSetUser{ DenomId: denomId, NftId: nftId, User: user, - Expires: expires, + Expiry: expiry, Sender: sender, } } diff --git a/modules/nft/types/query.pb.go b/modules/nft/types/query.pb.go index a28340a7..52fbc9e8 100644 --- a/modules/nft/types/query.pb.go +++ b/modules/nft/types/query.pb.go @@ -794,7 +794,7 @@ func (m *QueryUserExpiresRequest) GetNftId() string { // QueryExpiresResponse is the response type for the Query/Expires RPC method type QueryUserExpiresResponse struct { - Expires int64 `protobuf:"varint,1,opt,name=expires,proto3" json:"expires,omitempty"` + Expiry int64 `protobuf:"varint,1,opt,name=expiry,proto3" json:"expiry,omitempty"` } func (m *QueryUserExpiresResponse) Reset() { *m = QueryUserExpiresResponse{} } @@ -830,9 +830,9 @@ func (m *QueryUserExpiresResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryUserExpiresResponse proto.InternalMessageInfo -func (m *QueryUserExpiresResponse) GetExpires() int64 { +func (m *QueryUserExpiresResponse) GetExpiry() int64 { if m != nil { - return m.Expires + return m.Expiry } return 0 } @@ -959,69 +959,69 @@ func init() { func init() { proto.RegisterFile("nft/query.proto", fileDescriptor_ce02d034d3adf2e9) } var fileDescriptor_ce02d034d3adf2e9 = []byte{ - // 985 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x41, 0x6f, 0x1b, 0xc5, - 0x1b, 0xc6, 0xb3, 0x71, 0x62, 0xbb, 0x6f, 0xfe, 0x7f, 0xa5, 0x9d, 0xa4, 0xad, 0x63, 0x8a, 0x6d, - 0xa6, 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75, 0xba, 0x6a, 0x6f, - 0xb8, 0xe3, 0xee, 0x8a, 0xbe, 0xae, 0xc8, 0x99, 0x1a, 0x55, 0xee, 0x8b, 0xf6, 0xb0, 0xc7, 0xa4, - 0x1e, 0xba, 0x3a, 0x88, 0x98, 0xdc, 0x29, 0xea, 0x3f, 0xda, 0x0f, 0xff, 0x0d, 0x00, 0x00, 0xff, - 0xff, 0x7f, 0xca, 0x4c, 0x12, 0xf7, 0x0b, 0x00, 0x00, + // 983 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0x4f, 0x6f, 0x1b, 0x45, + 0x18, 0xc6, 0xb3, 0x71, 0x62, 0xbb, 0x6f, 0x40, 0x69, 0x27, 0x69, 0xeb, 0x98, 0x62, 0x9b, 0x69, + 0x9b, 0xa6, 0x69, 0xba, 0xdb, 0xa4, 0x48, 0x48, 0x1c, 0x38, 0x38, 0xe0, 0x12, 0x21, 0x35, 0xb0, + 0x94, 0x4b, 0x85, 0x54, 0x6d, 0xe2, 0x59, 0xc7, 0xc2, 0x9e, 0xd9, 0x78, 0xc6, 0x80, 0x55, 0x45, + 0x48, 0xa8, 0x57, 0x44, 0x24, 0x8e, 0x7c, 0x12, 0xbe, 0x41, 0x8f, 0x95, 0xb8, 0x70, 0x8a, 0x50, + 0xc2, 0x1d, 0xa9, 0x9f, 0x00, 0xcd, 0x9f, 0xb5, 0x77, 0xb2, 0xeb, 0x14, 0xad, 0x7a, 0xf3, 0xee, + 0x3e, 0xf3, 0x3e, 0xbf, 0x79, 0xdf, 0x9d, 0x67, 0x0d, 0x8b, 0x34, 0x14, 0xde, 0xe1, 0x90, 0x0c, + 0x46, 0x6e, 0x34, 0x60, 0x82, 0xa1, 0x85, 0xee, 0xa0, 0xcb, 0xfb, 0xac, 0xed, 0xd2, 0x50, 0x54, + 0x97, 0x3b, 0xac, 0xc3, 0xd4, 0x7d, 0x4f, 0xf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 0x3a, 0xa7, 0x03, + 0x27, 0xeb, 0x75, 0xce, 0x48, 0x12, 0xfc, 0x50, 0xe1, 0xdc, 0x47, 0xf7, 0xce, 0xe3, 0x10, 0x2d, + 0xcc, 0x24, 0x7a, 0xe1, 0x40, 0xc9, 0x24, 0x03, 0xca, 0xd8, 0xb1, 0x9d, 0x3e, 0xd5, 0x0f, 0x2e, + 0x50, 0x18, 0x8a, 0x0f, 0x15, 0x85, 0x8b, 0x36, 0xce, 0x53, 0xc4, 0x61, 0x93, 0x85, 0xd1, 0x6c, + 0xbd, 0x3c, 0xad, 0x39, 0xaf, 0x4e, 0x6b, 0xce, 0xdf, 0xa7, 0x35, 0xe7, 0xf8, 0xac, 0x36, 0xf3, + 0xea, 0xac, 0x36, 0xf3, 0xd7, 0x59, 0x6d, 0xe6, 0xe9, 0x46, 0xa7, 0x2b, 0x0e, 0x86, 0x7b, 0xee, + 0x3e, 0xeb, 0xab, 0x8a, 0x94, 0x88, 0x71, 0xe5, 0x3e, 0x6b, 0x0f, 0x7b, 0x84, 0xab, 0xa1, 0x8b, + 0x51, 0x44, 0xf8, 0x5e, 0x51, 0xfd, 0xcd, 0x7e, 0xf8, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xda, + 0xc9, 0x53, 0xe6, 0xf5, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2005,8 +2005,8 @@ func (m *QueryUserExpiresResponse) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if m.Expires != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Expires)) + if m.Expiry != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.Expiry)) i-- dAtA[i] = 0x8 } @@ -2336,8 +2336,8 @@ func (m *QueryUserExpiresResponse) Size() (n int) { } var l int _ = l - if m.Expires != 0 { - n += 1 + sovQuery(uint64(m.Expires)) + if m.Expiry != 0 { + n += 1 + sovQuery(uint64(m.Expiry)) } return n } @@ -3987,9 +3987,9 @@ func (m *QueryUserExpiresResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType) } - m.Expires = 0 + m.Expiry = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3999,7 +3999,7 @@ func (m *QueryUserExpiresResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Expires |= int64(b&0x7F) << shift + m.Expiry |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/modules/nft/types/tx.pb.go b/modules/nft/types/tx.pb.go index 0572156c..168e7171 100644 --- a/modules/nft/types/tx.pb.go +++ b/modules/nft/types/tx.pb.go @@ -518,7 +518,7 @@ type MsgSetUser struct { DenomId string `protobuf:"bytes,1,opt,name=denom_id,json=denomId,proto3" json:"denom_id,omitempty"` NftId string `protobuf:"bytes,2,opt,name=nft_id,json=nftId,proto3" json:"nft_id,omitempty"` User string `protobuf:"bytes,3,opt,name=user,proto3" json:"user,omitempty"` - Expires int64 `protobuf:"varint,4,opt,name=expires,proto3" json:"expires,omitempty"` + Expiry int64 `protobuf:"varint,4,opt,name=expiry,proto3" json:"expiry,omitempty"` Sender string `protobuf:"bytes,5,opt,name=sender,proto3" json:"sender,omitempty"` } @@ -612,53 +612,53 @@ func init() { func init() { proto.RegisterFile("nft/tx.proto", fileDescriptor_09d30374d974e015) } var fileDescriptor_09d30374d974e015 = []byte{ - // 729 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcd, 0x6e, 0xd3, 0x4a, - 0x18, 0x8d, 0xe3, 0x24, 0x4e, 0xbe, 0xdc, 0xfe, 0xdc, 0xb9, 0xfd, 0x71, 0x73, 0xef, 0x4d, 0xaa, - 0x20, 0x44, 0x25, 0x50, 0x22, 0xc1, 0xae, 0xcb, 0x40, 0x11, 0x45, 0x04, 0x24, 0xd3, 0x6e, 0x58, - 0x50, 0xb9, 0xf1, 0x24, 0x19, 0x54, 0x8f, 0xa3, 0x99, 0xb1, 0xd4, 0xee, 0x79, 0x00, 0x78, 0x03, - 0x9e, 0x83, 0x27, 0xe8, 0xb2, 0x4b, 0x56, 0x15, 0xa4, 0x12, 0x42, 0x2c, 0x79, 0x02, 0x94, 0xf1, - 0xd8, 0x19, 0xdb, 0x4d, 0x57, 0x2c, 0x10, 0xbb, 0x99, 0x73, 0xa6, 0xdf, 0x9c, 0x73, 0xbe, 0xaf, - 0x13, 0xc3, 0x5f, 0x74, 0x28, 0xba, 0xe2, 0xb4, 0x33, 0x61, 0x81, 0x08, 0x50, 0x9d, 0x30, 0xc2, - 0xfd, 0xc0, 0xeb, 0xd0, 0xa1, 0x68, 0xac, 0x8d, 0x82, 0x51, 0x20, 0xf1, 0xee, 0x6c, 0x15, 0x1d, - 0x69, 0x7f, 0x2c, 0xc2, 0x52, 0x9f, 0x8f, 0xf6, 0x39, 0x0f, 0xf1, 0x23, 0x4c, 0x03, 0x1f, 0x2d, - 0x43, 0x91, 0x78, 0xb6, 0xb1, 0x6d, 0xec, 0xd4, 0x9c, 0x22, 0xf1, 0x10, 0x82, 0x12, 0x75, 0x7d, - 0x6c, 0x17, 0x25, 0x22, 0xd7, 0x68, 0x03, 0x2a, 0x7c, 0x30, 0xc6, 0xbe, 0x6b, 0x9b, 0x12, 0x55, - 0x3b, 0x89, 0x63, 0xea, 0x61, 0x66, 0x97, 0x14, 0x2e, 0x77, 0x12, 0x3f, 0xf3, 0x8f, 0x83, 0x13, - 0xbb, 0xac, 0x70, 0xb9, 0x43, 0x77, 0x60, 0xc5, 0x27, 0x54, 0x1c, 0x31, 0xcc, 0x05, 0x23, 0x03, - 0x81, 0x3d, 0xbb, 0xb2, 0x6d, 0xec, 0x54, 0x9d, 0xe5, 0x19, 0xec, 0x24, 0x28, 0xba, 0x0b, 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 0x11, 0x45, 0xe4, 0x8b, - 0x64, 0xfe, 0xf3, 0xd0, 0x0b, 0xa8, 0xeb, 0xaf, 0xeb, 0xbf, 0xd9, 0xf3, 0x1a, 0xd9, 0xb8, 0x75, - 0x03, 0xa9, 0xab, 0x8a, 0x07, 0x39, 0xa7, 0x4a, 0x11, 0x79, 0x55, 0x99, 0x71, 0x44, 0x87, 0xb0, - 0x94, 0x9e, 0xc5, 0xff, 0x17, 0x5d, 0x1d, 0x65, 0x7e, 0xfb, 0x46, 0x3a, 0x29, 0xbb, 0x07, 0x56, - 0x3c, 0x65, 0x39, 0x6d, 0x8a, 0xc8, 0x6b, 0xcb, 0x4c, 0x44, 0xbb, 0xd0, 0x7b, 0x7a, 0xfe, 0xa5, - 0x59, 0x38, 0x9f, 0x36, 0x8d, 0x8b, 0x69, 0xd3, 0xf8, 0x3c, 0x6d, 0x1a, 0xef, 0xae, 0x9a, 0x85, - 0x8b, 0xab, 0x66, 0xe1, 0xd3, 0x55, 0xb3, 0xf0, 0xea, 0xde, 0x88, 0x88, 0x71, 0x78, 0xdc, 0x19, - 0x04, 0x7e, 0x77, 0x56, 0x8a, 0x62, 0xd1, 0x55, 0x25, 0xbb, 0x7e, 0xe0, 0x85, 0x27, 0x98, 0x77, - 0xe5, 0xd7, 0xc5, 0xd9, 0x04, 0xf3, 0xe3, 0x8a, 0xfc, 0x7c, 0x78, 0xf0, 0x33, 0x00, 0x00, 0xff, - 0xff, 0xa0, 0xe2, 0x64, 0x2b, 0x71, 0x08, 0x00, 0x00, + // 726 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x56, 0xcd, 0x6e, 0xd3, 0x4c, + 0x14, 0x8d, 0xe3, 0xfc, 0xde, 0x7c, 0xfd, 0xf9, 0x86, 0xfe, 0xb8, 0x01, 0x92, 0x2a, 0x08, 0x51, + 0x09, 0x94, 0x48, 0xb0, 0xeb, 0x32,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0xff, 0x07, 0x63, 0xd7, + 0x11, 0x58, 0x3f, 0x5a, 0x96, 0x47, 0x57, 0x23, 0x42, 0x3b, 0xbc, 0x0d, 0x35, 0x17, 0xf3, 0x3e, + 0x23, 0x63, 0x41, 0x7c, 0x6a, 0x55, 0xe4, 0x95, 0x3a, 0x84, 0x56, 0xc1, 0x0c, 0x18, 0xb1, 0xaa, + 0x92, 0x09, 0x97, 0x68, 0x0b, 0x2a, 0x01, 0x23, 0x47, 0x23, 0x87, 0x8f, 0x2c, 0x90, 0x70, 0x39, + 0x60, 0xe4, 0x99, 0xc3, 0x47, 0x61, 0x00, 0xae, 0x23, 0x1c, 0xab, 0x16, 0x05, 0x10, 0xae, 0x77, + 0x0b, 0x3f, 0x3e, 0x35, 0x8d, 0xd6, 0x26, 0xac, 0xa7, 0xb2, 0xb3, 0x31, 0x1f, 0xfb, 0x94, 0xe3, + 0xd6, 0x4f, 0x03, 0x96, 0x7b, 0x7c, 0x78, 0xc0, 0x1c, 0xca, 0x07, 0x98, 0xbd, 0x7c, 0x7a, 0x90, + 0x89, 0xb5, 0x0d, 0x15, 0x37, 0xfc, 0x9b, 0x23, 0xe2, 0x46, 0xd1, 0x76, 0x6f, 0xfc, 0xba, 0x68, + 0xae, 0x4c, 0x1c, 0xef, 0x64, 0xb7, 0x15, 0x33, 0x2d, 0xbb, 0x2c, 0x97, 0xfb, 0xb3, 0x36, 0x98, + 0x5a, 0x1b, 0xb6, 0x22, 0x1b, 0x32, 0xeb, 0x6e, 0x79, 0x7a, 0xd1, 0x34, 0x0f, 0xed, 0xfd, 0xc8, + 0x4f, 0x2c, 0xba, 0x38, 0x13, 0xad, 0x75, 0xa7, 0x94, 0xea, 0xce, 0x2d, 0xa8, 0x32, 0xdc, 0x27, + 0x63, 0x82, 0xa9, 0x90, 0xa1, 0x56, 0xed, 0x19, 0x90, 0x4a, 0xa6, 0x92, 0x4a, 0x46, 0xa5, 0x60, + 0xc1, 0x46, 0xda, 0x6b, 0x12, 0xc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0xcc, 0xfd, 0xdf, 0xa1, + 0x57, 0x50, 0xd3, 0xdf, 0xd6, 0x9b, 0xf3, 0xe7, 0x35, 0xb2, 0x7e, 0xe7, 0x1a, 0x52, 0x57, 0x15, + 0x8f, 0x71, 0x46, 0x95, 0x22, 0xb2, 0xaa, 0xe6, 0x86, 0x11, 0x1d, 0xc2, 0x52, 0x7a, 0x12, 0x6f, + 0x2f, 0xba, 0x3a, 0xca, 0xfc, 0xee, 0xb5, 0x74, 0x52, 0x76, 0x0f, 0xca, 0xf1, 0x8c, 0x65, 0xb4, + 0x29, 0x22, 0xab, 0x6d, 0x6e, 0x22, 0x5a, 0xb9, 0xee, 0xf3, 0xb3, 0x6f, 0x8d, 0xdc, 0xd9, 0xb4, + 0x61, 0x9c, 0x4f, 0x1b, 0xc6, 0xd7, 0x69, 0xc3, 0xf8, 0x70, 0xd9, 0xc8, 0x9d, 0x5f, 0x36, 0x72, + 0x5f, 0x2e, 0x1b, 0xb9, 0x37, 0x0f, 0x86, 0x44, 0x8c, 0x82, 0xe3, 0x76, 0xdf, 0xf7, 0x3a, 0x61, + 0x29, 0x8a, 0x45, 0x47, 0x95, 0xec, 0x78, 0xbe, 0x1b, 0x9c, 0x60, 0xde, 0x91, 0xdf, 0x16, 0x93, + 0x31, 0xe6, 0xc7, 0x25, 0xf9, 0xf1, 0xf0, 0xe8, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2c, 0x6a, + 0xee, 0xb6, 0x6f, 0x08, 0x00, 0x00, } func (this *MsgIssueDenom) Equal(that interface{}) bool { @@ -1807,8 +1807,8 @@ func (m *MsgSetUser) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x2a } - if m.Expires != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.Expires)) + if m.Expiry != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Expiry)) i-- dAtA[i] = 0x20 } @@ -2154,8 +2154,8 @@ func (m *MsgSetUser) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.Expires != 0 { - n += 1 + sovTx(uint64(m.Expires)) + if m.Expiry != 0 { + n += 1 + sovTx(uint64(m.Expiry)) } l = len(m.Sender) if l > 0 { @@ -4162,9 +4162,9 @@ func (m *MsgSetUser) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expires", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Expiry", wireType) } - m.Expires = 0 + m.Expiry = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -4174,7 +4174,7 @@ func (m *MsgSetUser) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Expires |= int64(b&0x7F) << shift + m.Expiry |= int64(b&0x7F) << shift if b < 0x80 { break } diff --git a/proto/nft/query.proto b/proto/nft/query.proto index 7c46c088..82f700cb 100644 --- a/proto/nft/query.proto +++ b/proto/nft/query.proto @@ -148,7 +148,7 @@ message QueryUserExpiresRequest { } // QueryExpiresResponse is the response type for the Query/Expires RPC method -message QueryUserExpiresResponse { int64 expires = 1; } +message QueryUserExpiresResponse { int64 expiry = 1; } // QueryHasUserRequest is the request type for the Query/HasUser RPC method message QueryHasUserRequest { diff --git a/proto/nft/tx.proto b/proto/nft/tx.proto index 9a8654c4..763cd846 100644 --- a/proto/nft/tx.proto +++ b/proto/nft/tx.proto @@ -131,7 +131,7 @@ message MsgSetUser { string denom_id = 1; string nft_id = 2; string user = 3; - int64 expires = 4; + int64 expiry = 4; string sender = 5; }