From 169ea30bf87e094cd98f544982ac4dd8205f5c41 Mon Sep 17 00:00:00 2001 From: Lorenz Herzberger Date: Wed, 24 May 2023 10:16:20 +0200 Subject: [PATCH] added machine type Signed-off-by: Lorenz Herzberger --- proto/planetmintgo/machine/machine.proto | 15 + x/machine/types/machine.pb.go | 595 +++++++++++++++++++++++ 2 files changed, 610 insertions(+) create mode 100644 proto/planetmintgo/machine/machine.proto create mode 100644 x/machine/types/machine.pb.go diff --git a/proto/planetmintgo/machine/machine.proto b/proto/planetmintgo/machine/machine.proto new file mode 100644 index 0000000..2b6a812 --- /dev/null +++ b/proto/planetmintgo/machine/machine.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package planetmintgo.machine; + +option go_package = "planetmint-go/x/machine/types"; + +message Machine { + + string name = 1; + string ticker = 2; + uint64 issued = 3; + uint64 precision = 4; + string issuerPlanetmint = 5; + string issuerLiquid = 6; + string cid = 7; +} diff --git a/x/machine/types/machine.pb.go b/x/machine/types/machine.pb.go new file mode 100644 index 0000000..91f2de8 --- /dev/null +++ b/x/machine/types/machine.pb.go @@ -0,0 +1,595 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: planetmintgo/machine/machine.proto + +package types + +import ( + fmt "fmt" + 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 Machine struct { + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Ticker string `protobuf:"bytes,2,opt,name=ticker,proto3" json:"ticker,omitempty"` + Issued uint64 `protobuf:"varint,3,opt,name=issued,proto3" json:"issued,omitempty"` + Precision uint64 `protobuf:"varint,4,opt,name=precision,proto3" json:"precision,omitempty"` + IssuerPlanetmint string `protobuf:"bytes,5,opt,name=issuerPlanetmint,proto3" json:"issuerPlanetmint,omitempty"` + IssuerLiquid string `protobuf:"bytes,6,opt,name=issuerLiquid,proto3" json:"issuerLiquid,omitempty"` + Cid string `protobuf:"bytes,7,opt,name=cid,proto3" json:"cid,omitempty"` +} + +func (m *Machine) Reset() { *m = Machine{} } +func (m *Machine) String() string { return proto.CompactTextString(m) } +func (*Machine) ProtoMessage() {} +func (*Machine) Descriptor() ([]byte, []int) { + return fileDescriptor_1bb279745bef7c4b, []int{0} +} +func (m *Machine) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Machine) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Machine.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 *Machine) XXX_Merge(src proto.Message) { + xxx_messageInfo_Machine.Merge(m, src) +} +func (m *Machine) XXX_Size() int { + return m.Size() +} +func (m *Machine) XXX_DiscardUnknown() { + xxx_messageInfo_Machine.DiscardUnknown(m) +} + +var xxx_messageInfo_Machine proto.InternalMessageInfo + +func (m *Machine) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Machine) GetTicker() string { + if m != nil { + return m.Ticker + } + return "" +} + +func (m *Machine) GetIssued() uint64 { + if m != nil { + return m.Issued + } + return 0 +} + +func (m *Machine) GetPrecision() uint64 { + if m != nil { + return m.Precision + } + return 0 +} + +func (m *Machine) GetIssuerPlanetmint() string { + if m != nil { + return m.IssuerPlanetmint + } + return "" +} + +func (m *Machine) GetIssuerLiquid() string { + if m != nil { + return m.IssuerLiquid + } + return "" +} + +func (m *Machine) GetCid() string { + if m != nil { + return m.Cid + } + return "" +} + +func init() { + proto.RegisterType((*Machine)(nil), "planetmintgo.machine.Machine") +} + +func init() { + proto.RegisterFile("planetmintgo/machine/machine.proto", fileDescriptor_1bb279745bef7c4b) +} + +var fileDescriptor_1bb279745bef7c4b = []byte{ + // 233 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0xc8, 0x49, 0xcc, + 0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0xcf, 0x4d, 0x4c, 0xce, 0xc8, 0xcc, 0x4b, + 0x85, 0xd1, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x22, 0xc8, 0x6a, 0xf4, 0xa0, 0x72, 0x4a, + 0x67, 0x19, 0xb9, 0xd8, 0x7d, 0x21, 0x6c, 0x21, 0x21, 0x2e, 0x96, 0xbc, 0xc4, 0xdc, 0x54, 0x09, + 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x30, 0x5b, 0x48, 0x8c, 0x8b, 0xad, 0x24, 0x33, 0x39, 0x3b, + 0xb5, 0x48, 0x82, 0x09, 0x2c, 0x0a, 0xe5, 0x81, 0xc4, 0x33, 0x8b, 0x8b, 0x4b, 0x53, 0x53, 0x24, + 0x98, 0x15, 0x18, 0x35, 0x58, 0x82, 0xa0, 0x3c, 0x21, 0x19, 0x2e, 0xce, 0x82, 0xa2, 0xd4, 0xe4, + 0xcc, 0xe2, 0xcc, 0xfc, 0x3c, 0x09, 0x16, 0xb0, 0x14, 0x42, 0x40, 0x48, 0x8b, 0x4b, 0x00, 0xac, + 0xae, 0x28, 0x00, 0xee, 0x16, 0x09, 0x56, 0xb0, 0xb9, 0x18, 0xe2, 0x42, 0x4a, 0x5c, 0x3c, 0x10, + 0x31, 0x9f, 0xcc, 0xc2, 0xd2, 0xcc, 0x14, 0x09, 0x36, 0xb0, 0x3a, 0x14, 0x31, 0x21, 0x01, 0x2e, + 0xe6, 0xe4, 0xcc, 0x14, 0x09, 0x76, 0xb0, 0x14, 0x88, 0xe9, 0x64, 0x7e, 0xe2, 0x91, 0x1c, 0xe3, + 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, + 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xb2, 0x08, 0xff, 0xeb, 0xa6, 0xe7, 0xeb, 0x57, 0xc0, 0x83, + 0xa9, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x1c, 0x4a, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x75, 0xea, 0x66, 0x71, 0x4b, 0x01, 0x00, 0x00, +} + +func (m *Machine) 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 *Machine) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Machine) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Cid) > 0 { + i -= len(m.Cid) + copy(dAtA[i:], m.Cid) + i = encodeVarintMachine(dAtA, i, uint64(len(m.Cid))) + i-- + dAtA[i] = 0x3a + } + if len(m.IssuerLiquid) > 0 { + i -= len(m.IssuerLiquid) + copy(dAtA[i:], m.IssuerLiquid) + i = encodeVarintMachine(dAtA, i, uint64(len(m.IssuerLiquid))) + i-- + dAtA[i] = 0x32 + } + if len(m.IssuerPlanetmint) > 0 { + i -= len(m.IssuerPlanetmint) + copy(dAtA[i:], m.IssuerPlanetmint) + i = encodeVarintMachine(dAtA, i, uint64(len(m.IssuerPlanetmint))) + i-- + dAtA[i] = 0x2a + } + if m.Precision != 0 { + i = encodeVarintMachine(dAtA, i, uint64(m.Precision)) + i-- + dAtA[i] = 0x20 + } + if m.Issued != 0 { + i = encodeVarintMachine(dAtA, i, uint64(m.Issued)) + i-- + dAtA[i] = 0x18 + } + if len(m.Ticker) > 0 { + i -= len(m.Ticker) + copy(dAtA[i:], m.Ticker) + i = encodeVarintMachine(dAtA, i, uint64(len(m.Ticker))) + i-- + dAtA[i] = 0x12 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintMachine(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintMachine(dAtA []byte, offset int, v uint64) int { + offset -= sovMachine(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Machine) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Name) + if l > 0 { + n += 1 + l + sovMachine(uint64(l)) + } + l = len(m.Ticker) + if l > 0 { + n += 1 + l + sovMachine(uint64(l)) + } + if m.Issued != 0 { + n += 1 + sovMachine(uint64(m.Issued)) + } + if m.Precision != 0 { + n += 1 + sovMachine(uint64(m.Precision)) + } + l = len(m.IssuerPlanetmint) + if l > 0 { + n += 1 + l + sovMachine(uint64(l)) + } + l = len(m.IssuerLiquid) + if l > 0 { + n += 1 + l + sovMachine(uint64(l)) + } + l = len(m.Cid) + if l > 0 { + n += 1 + l + sovMachine(uint64(l)) + } + return n +} + +func sovMachine(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMachine(x uint64) (n int) { + return sovMachine(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Machine) 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 ErrIntOverflowMachine + } + 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: Machine: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Machine: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMachine + } + 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 ErrInvalidLengthMachine + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMachine + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMachine + } + 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 ErrInvalidLengthMachine + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMachine + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ticker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Issued", wireType) + } + m.Issued = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMachine + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Issued |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Precision", wireType) + } + m.Precision = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMachine + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Precision |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IssuerPlanetmint", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMachine + } + 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 ErrInvalidLengthMachine + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMachine + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IssuerPlanetmint = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field IssuerLiquid", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMachine + } + 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 ErrInvalidLengthMachine + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMachine + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.IssuerLiquid = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Cid", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMachine + } + 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 ErrInvalidLengthMachine + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMachine + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Cid = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipMachine(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMachine + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipMachine(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, ErrIntOverflowMachine + } + 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, ErrIntOverflowMachine + } + 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, ErrIntOverflowMachine + } + 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, ErrInvalidLengthMachine + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupMachine + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthMachine + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthMachine = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowMachine = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupMachine = fmt.Errorf("proto: unexpected end of group") +)