From bcff4d5610dfb2af2f01092dbcf4761e3c8396f5 Mon Sep 17 00:00:00 2001 From: Tim Lind Date: Mon, 26 Apr 2021 16:30:23 +0200 Subject: [PATCH] Revert removal of coin.proto --- proto/sifnode/dispensation/v1/types.proto | 4 +- third_party/proto/cosmos/base/coin.proto | 40 ++++++++ x/dispensation/types/types.pb.go | 118 ++++++++++++---------- 3 files changed, 107 insertions(+), 55 deletions(-) create mode 100644 third_party/proto/cosmos/base/coin.proto diff --git a/proto/sifnode/dispensation/v1/types.proto b/proto/sifnode/dispensation/v1/types.proto index beb78daea4..8aadb586fd 100644 --- a/proto/sifnode/dispensation/v1/types.proto +++ b/proto/sifnode/dispensation/v1/types.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package sifnode.dispensation.v1; import "gogoproto/gogo.proto"; +import "cosmos/base/coin.proto"; option go_package = "github.com/Sifchain/sifnode/x/dispensation/types"; @@ -32,7 +33,8 @@ message DistributionRecord { ClaimStatus claim_status = 1; string distribution_name = 2; string recipient_address = 3; - repeated string coins = 4 [ + repeated cosmos.base.v1beta1.Coin coins = 4 [ + (gogoproto.nullable) = false, (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.moretags) = "yaml:\"coins\"" ]; diff --git a/third_party/proto/cosmos/base/coin.proto b/third_party/proto/cosmos/base/coin.proto new file mode 100644 index 0000000000..fab75284b7 --- /dev/null +++ b/third_party/proto/cosmos/base/coin.proto @@ -0,0 +1,40 @@ +syntax = "proto3"; +package cosmos.base.v1beta1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/types"; +option (gogoproto.goproto_stringer_all) = false; +option (gogoproto.stringer_all) = false; + +// Coin defines a token with a denomination and an amount. +// +// NOTE: The amount field is an Int which implements the custom method +// signatures required by gogoproto. +message Coin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecCoin defines a token with a denomination and a decimal amount. +// +// NOTE: The amount field is an Dec which implements the custom method +// signatures required by gogoproto. +message DecCoin { + option (gogoproto.equal) = true; + + string denom = 1; + string amount = 2 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} + +// IntProto defines a Protobuf wrapper around an Int object. +message IntProto { + string int = 1 [(gogoproto.customtype) = "Int", (gogoproto.nullable) = false]; +} + +// DecProto defines a Protobuf wrapper around a Dec object. +message DecProto { + string dec = 1 [(gogoproto.customtype) = "Dec", (gogoproto.nullable) = false]; +} diff --git a/x/dispensation/types/types.pb.go b/x/dispensation/types/types.pb.go index 1927a14655..5533056dff 100644 --- a/x/dispensation/types/types.pb.go +++ b/x/dispensation/types/types.pb.go @@ -6,6 +6,7 @@ package types import ( fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" io "io" @@ -140,7 +141,7 @@ type DistributionRecord struct { ClaimStatus ClaimStatus `protobuf:"varint,1,opt,name=claim_status,json=claimStatus,proto3,enum=sifnode.dispensation.v1.ClaimStatus" json:"claim_status,omitempty"` DistributionName string `protobuf:"bytes,2,opt,name=distribution_name,json=distributionName,proto3" json:"distribution_name,omitempty"` RecipientAddress string `protobuf:"bytes,3,opt,name=recipient_address,json=recipientAddress,proto3" json:"recipient_address,omitempty"` - Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins,omitempty" yaml:"coins"` + Coins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,4,rep,name=coins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"coins" yaml:"coins"` DistributionStartHeight int64 `protobuf:"varint,5,opt,name=distribution_start_height,json=distributionStartHeight,proto3" json:"distribution_start_height,omitempty"` DistributionCompletedHeight int64 `protobuf:"varint,6,opt,name=distribution_completed_height,json=distributionCompletedHeight,proto3" json:"distribution_completed_height,omitempty"` } @@ -428,48 +429,50 @@ func init() { } var fileDescriptor_bfdf912039cd8799 = []byte{ - // 647 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x4e, 0x13, 0x41, - 0x14, 0xee, 0x50, 0x21, 0x61, 0x5a, 0xcc, 0x3a, 0x10, 0x58, 0x40, 0x4a, 0x5d, 0x34, 0xa9, 0xa0, - 0xad, 0xe0, 0x1d, 0xf1, 0xa6, 0x7f, 0xe2, 0x2a, 0x94, 0x66, 0x76, 0xd1, 0x68, 0x8c, 0xeb, 0xb0, - 0x3b, 0xb4, 0x13, 0xbb, 0x3b, 0x9b, 0x9d, 0x29, 0xca, 0x33, 0x78, 0x63, 0x62, 0xe2, 0x43, 0xf8, - 0x24, 0x5e, 0x72, 0xe9, 0x95, 0x1a, 0x78, 0x03, 0x9f, 0xc0, 0xec, 0x76, 0x8b, 0xbb, 0x14, 0x12, - 0xb8, 0x6a, 0xf7, 0x7c, 0xdf, 0xf9, 0xce, 0x37, 0x73, 0xce, 0x19, 0xb8, 0x22, 0xd8, 0x81, 0xc7, - 0x1d, 0x5a, 0x71, 0x98, 0xf0, 0xa9, 0x27, 0x88, 0x64, 0xdc, 0xab, 0x1c, 0xae, 0x57, 0xe4, 0x91, - 0x4f, 0x45, 0xd9, 0x0f, 0xb8, 0xe4, 0x68, 0x2e, 0x26, 0x95, 0x93, 0xa4, 0xf2, 0xe1, 0xfa, 0xc2, - 0x4c, 0x87, 0x77, 0x78, 0xc4, 0xa9, 0x84, 0xff, 0x06, 0x74, 0xed, 0x3d, 0xcc, 0x6f, 0x51, 0x8f, - 0x0a, 0x26, 0x0c, 0x49, 0x24, 0x45, 0x6b, 0xf0, 0x16, 0x71, 0x9c, 0x80, 0x0a, 0x61, 0x7d, 0xec, - 0x32, 0x49, 0x7b, 0x4c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 0x55, 0x1d, 0x37, 0xf0, 0x6e, 0x5b, 0x01, 0xab, 0x04, 0xe6, 0x12, 0x3b, 0x8a, 0x6e, 0x43, - 0xb5, 0xbe, 0x5d, 0xd5, 0x77, 0x2c, 0xc3, 0xac, 0x9a, 0x7b, 0xc6, 0x39, 0x2d, 0x15, 0xce, 0xa4, - 0xd0, 0x76, 0xb3, 0xd5, 0xd0, 0x5b, 0x5b, 0x0a, 0x40, 0x0b, 0x70, 0x36, 0x85, 0xd4, 0x77, 0x77, - 0xda, 0xdb, 0x4d, 0xb3, 0xd9, 0x50, 0xc6, 0x6a, 0xcf, 0x7f, 0x9c, 0x14, 0xc0, 0xf1, 0x49, 0x01, - 0xfc, 0x39, 0x29, 0x80, 0x2f, 0xa7, 0x85, 0xcc, 0xf1, 0x69, 0x21, 0xf3, 0xf3, 0xb4, 0x90, 0x79, - 0xf3, 0x28, 0xb1, 0x87, 0x06, 0x3b, 0xb0, 0xbb, 0x84, 0x79, 0x95, 0xe1, 0x73, 0xf9, 0x29, 0xfd, - 0x60, 0x46, 0x5b, 0xb9, 0x3f, 0x11, 0xbd, 0x7f, 0x8f, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x34, - 0xf4, 0x1c, 0xfb, 0x55, 0x05, 0x00, 0x00, + // 683 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x52, 0xd3, 0x4e, + 0x14, 0x6f, 0xe8, 0x1f, 0x66, 0xd8, 0x96, 0xff, 0xd4, 0x85, 0x81, 0x02, 0x52, 0x6a, 0xd0, 0x99, + 0x08, 0x9a, 0xd8, 0x7a, 0xc7, 0x95, 0xfd, 0x12, 0xa3, 0x50, 0x3a, 0x49, 0xd0, 0xd1, 0x71, 0x8c, + 0xdb, 0x64, 0x69, 0x77, 0x6c, 0xb2, 0x31, 0xbb, 0x45, 0x79, 0x0b, 0x67, 0x9c, 0x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b, 0xae, 0x25, 0x37, 0x02, 0xb2, 0x1e, 0x72, 0xb5, 0x9c, 0xf5, 0xef, + 0x10, 0x64, 0x6c, 0x27, 0xe4, 0x4d, 0x17, 0x39, 0x38, 0x4e, 0xa4, 0x90, 0x04, 0xda, 0xc8, 0x09, + 0xaf, 0xe7, 0x63, 0x8b, 0x78, 0x04, 0xbb, 0xfc, 0x22, 0xeb, 0x6c, 0x44, 0xbe, 0x00, 0xe2, 0xcc, + 0xe1, 0x67, 0x30, 0x19, 0x54, 0x8a, 0x15, 0xff, 0x2b, 0x67, 0xa5, 0x5c, 0x75, 0x51, 0x8e, 0x6a, + 0x28, 0x07, 0x35, 0x94, 0x0f, 0x2a, 0x5d, 0xcc, 0x51, 0x45, 0x6e, 0x50, 0xe2, 0xd6, 0x9f, 0x1d, + 0x9f, 0xae, 0x66, 0xfe, 0x9c, 0xae, 0xe6, 0x0f, 0x91, 0x33, 0xd8, 0x14, 0x43, 0x2f, 0xf1, 0xe8, + 0xd7, 0xaa, 0xd4, 0x23, 0xbc, 0x3f, 0xec, 0xca, 0x16, 0x75, 0x94, 0xb8, 0x01, 0xd1, 0xe7, 0x31, + 0xb3, 0x3f, 0xc5, 0xed, 0x0c, 0x04, 0x98, 0x16, 0x45, 0x82, 0x9b, 0x60, 0x31, 0x75, 0x19, 0xc6, + 0x91, 0xcf, 0xcd, 0x3e, 0x26, 0xbd, 0x3e, 0x2f, 0x4e, 0x96, 0x05, 0x29, 0xab, 0x2d, 0x24, 0x09, + 0x7a, 0x80, 0xbf, 0x08, 0x61, 0x58, 0x07, 0x2b, 0x29, 0x5f, 0x8b, 0x3a, 0xde, 0x00, 0x73, 0x6c, + 0x8f, 0xfc, 0xa7, 0x42, 0xff, 0xe5, 0x24, 0xa9, 0x31, 0xe2, 0x44, 0x1a, 0xe2, 0x10, 0xcc, 0x8e, + 0xf7, 0x8a, 0xc1, 0x0f, 0x60, 0x2e, 0x25, 0xed, 0x47, 0xf6, 0x70, 0x30, 0x72,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xb3, 0xdd, 0x32, 0x5a, 0xcd, 0xc2, 0x44, 0xfd, 0xe5, 0xf1, 0x59, 0x49, + 0x38, 0x39, 0x2b, 0x09, 0xbf, 0xcf, 0x4a, 0xc2, 0xb7, 0xf3, 0x52, 0xe6, 0xe4, 0xbc, 0x94, 0xf9, + 0x79, 0x5e, 0xca, 0xbc, 0x7b, 0x92, 0xd8, 0x43, 0x9d, 0xec, 0x5b, 0x7d, 0x44, 0x5c, 0x65, 0xf4, + 0xca, 0x7e, 0x4d, 0xbf, 0xb3, 0xe1, 0x56, 0x76, 0xa7, 0xc2, 0xe7, 0xf1, 0xe9, 0xdf, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xac, 0xc4, 0xa5, 0x83, 0x8c, 0x05, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -543,9 +546,14 @@ func (m *DistributionRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { } if len(m.Coins) > 0 { for iNdEx := len(m.Coins) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.Coins[iNdEx]) - copy(dAtA[i:], m.Coins[iNdEx]) - i = encodeVarintTypes(dAtA, i, uint64(len(m.Coins[iNdEx]))) + { + size, err := m.Coins[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x22 } @@ -769,8 +777,8 @@ func (m *DistributionRecord) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } if len(m.Coins) > 0 { - for _, s := range m.Coins { - l = len(s) + for _, e := range m.Coins { + l = e.Size() n += 1 + l + sovTypes(uint64(l)) } } @@ -1081,7 +1089,7 @@ func (m *DistributionRecord) Unmarshal(dAtA []byte) error { if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Coins", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -1091,23 +1099,25 @@ func (m *DistributionRecord) 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 ErrInvalidLengthTypes } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTypes } if postIndex > l { return io.ErrUnexpectedEOF } - m.Coins = append(m.Coins, string(dAtA[iNdEx:postIndex])) + m.Coins = append(m.Coins, types.Coin{}) + if err := m.Coins[len(m.Coins)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 5: if wireType != 0 {