From 45fc1a764388eab8dc89f8ed404e9ec5cf54cfbe Mon Sep 17 00:00:00 2001 From: Derrick Lee Date: Thu, 27 Oct 2022 17:45:32 -0700 Subject: [PATCH] Add generic Claim type (#1371) --- docs/core/proto-docs.md | 39 ++ proto/kava/incentive/v1beta1/claims.proto | 46 ++- x/incentive/types/claims.go | 52 +++ x/incentive/types/claims.pb.go | 449 +++++++++++++++++++--- 4 files changed, 525 insertions(+), 61 deletions(-) diff --git a/docs/core/proto-docs.md b/docs/core/proto-docs.md index 34d1765a..bbd36a30 100644 --- a/docs/core/proto-docs.md +++ b/docs/core/proto-docs.md @@ -307,6 +307,7 @@ - [kava/incentive/v1beta1/claims.proto](#kava/incentive/v1beta1/claims.proto) - [BaseClaim](#kava.incentive.v1beta1.BaseClaim) - [BaseMultiClaim](#kava.incentive.v1beta1.BaseMultiClaim) + - [Claim](#kava.incentive.v1beta1.Claim) - [DelegatorClaim](#kava.incentive.v1beta1.DelegatorClaim) - [EarnClaim](#kava.incentive.v1beta1.EarnClaim) - [HardLiquidityProviderClaim](#kava.incentive.v1beta1.HardLiquidityProviderClaim) @@ -318,6 +319,8 @@ - [SwapClaim](#kava.incentive.v1beta1.SwapClaim) - [USDXMintingClaim](#kava.incentive.v1beta1.USDXMintingClaim) + - [ClaimType](#kava.incentive.v1beta1.ClaimType) + - [kava/incentive/v1beta1/params.proto](#kava/incentive/v1beta1/params.proto) - [MultiRewardPeriod](#kava.incentive.v1beta1.MultiRewardPeriod) - [Multiplier](#kava.incentive.v1beta1.Multiplier) @@ -4454,6 +4457,24 @@ BaseMultiClaim is a claim with multiple reward coin types + + +### Claim +Claim stores any generic rewards that can be claimed by owner + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| `type` | [ClaimType](#kava.incentive.v1beta1.ClaimType) | | | +| `owner` | [bytes](#bytes) | | | +| `reward` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | +| `reward_indexes` | [MultiRewardIndex](#kava.incentive.v1beta1.MultiRewardIndex) | repeated | | + + + + + + ### DelegatorClaim @@ -4614,6 +4635,24 @@ USDXMintingClaim is for USDX minting rewards + + + +### ClaimType +ClaimType is the type of claim + +| Name | Number | Description | +| ---- | ------ | ----------- | +| CLAIM_TYPE_UNSPECIFIED | 0 | | +| CLAIM_TYPE_HARD_BORROW | 1 | | +| CLAIM_TYPE_HARD_SUPPLY | 2 | | +| CLAIM_TYPE_DELEGATOR | 3 | | +| CLAIM_TYPE_EARN | 4 | | +| CLAIM_TYPE_SAVINGS | 5 | | +| CLAIM_TYPE_SWAP | 6 | | +| CLAIM_TYPE_USDX_MINTING | 7 | | + + diff --git a/proto/kava/incentive/v1beta1/claims.proto b/proto/kava/incentive/v1beta1/claims.proto index df28d2cc..f1b128af 100644 --- a/proto/kava/incentive/v1beta1/claims.proto +++ b/proto/kava/incentive/v1beta1/claims.proto @@ -13,8 +13,6 @@ option (gogoproto.goproto_getters_all) = false; // BaseClaim is a claim with a single reward coin types message BaseClaim { - option (cosmos_proto.implements_interface) = "Claim"; - bytes owner = 1 [ (cosmos_proto.scalar) = "cosmos.AddressBytes", (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" @@ -25,8 +23,6 @@ message BaseClaim { // BaseMultiClaim is a claim with multiple reward coin types message BaseMultiClaim { - option (cosmos_proto.implements_interface) = "Claim"; - bytes owner = 1 [ (cosmos_proto.scalar) = "cosmos.AddressBytes", (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" @@ -66,8 +62,6 @@ message MultiRewardIndexesProto { // USDXMintingClaim is for USDX minting rewards message USDXMintingClaim { - option (cosmos_proto.implements_interface) = "Claim"; - BaseClaim base_claim = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; repeated RewardIndex reward_indexes = 2 [(gogoproto.castrepeated) = "RewardIndexes", (gogoproto.nullable) = false]; @@ -75,8 +69,6 @@ message USDXMintingClaim { // HardLiquidityProviderClaim stores the hard liquidity provider rewards that can be claimed by owner message HardLiquidityProviderClaim { - option (cosmos_proto.implements_interface) = "Claim"; - BaseMultiClaim base_claim = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; repeated MultiRewardIndex supply_reward_indexes = 2 @@ -88,8 +80,6 @@ message HardLiquidityProviderClaim { // DelegatorClaim stores delegation rewards that can be claimed by owner message DelegatorClaim { - option (cosmos_proto.implements_interface) = "Claim"; - BaseMultiClaim base_claim = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; repeated MultiRewardIndex reward_indexes = 2 @@ -98,8 +88,6 @@ message DelegatorClaim { // SwapClaim stores the swap rewards that can be claimed by owner message SwapClaim { - option (cosmos_proto.implements_interface) = "Claim"; - BaseMultiClaim base_claim = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; repeated MultiRewardIndex reward_indexes = 2 @@ -108,8 +96,6 @@ message SwapClaim { // SavingsClaim stores the savings rewards that can be claimed by owner message SavingsClaim { - option (cosmos_proto.implements_interface) = "Claim"; - BaseMultiClaim base_claim = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; repeated MultiRewardIndex reward_indexes = 2 @@ -118,10 +104,38 @@ message SavingsClaim { // EarnClaim stores the earn rewards that can be claimed by owner message EarnClaim { - option (cosmos_proto.implements_interface) = "Claim"; - BaseMultiClaim base_claim = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; repeated MultiRewardIndex reward_indexes = 2 [(gogoproto.castrepeated) = "MultiRewardIndexes", (gogoproto.nullable) = false]; } + +// ClaimType is the type of claim +enum ClaimType { + option (gogoproto.goproto_enum_prefix) = false; + + CLAIM_TYPE_UNSPECIFIED = 0; + CLAIM_TYPE_HARD_BORROW = 1; + CLAIM_TYPE_HARD_SUPPLY = 2; + CLAIM_TYPE_DELEGATOR = 3; + CLAIM_TYPE_EARN = 4; + CLAIM_TYPE_SAVINGS = 5; + CLAIM_TYPE_SWAP = 6; + CLAIM_TYPE_USDX_MINTING = 7; +} + +// Claim stores any generic rewards that can be claimed by owner +message Claim { + ClaimType type = 1; + + bytes owner = 2 [ + (cosmos_proto.scalar) = "cosmos.AddressBytes", + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; + + repeated cosmos.base.v1beta1.Coin reward = 3 + [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins", (gogoproto.nullable) = false]; + + repeated MultiRewardIndex reward_indexes = 4 + [(gogoproto.castrepeated) = "MultiRewardIndexes", (gogoproto.nullable) = false]; +} diff --git a/x/incentive/types/claims.go b/x/incentive/types/claims.go index ac7bc5f6..b9862b2a 100644 --- a/x/incentive/types/claims.go +++ b/x/incentive/types/claims.go @@ -57,6 +57,58 @@ func (c BaseMultiClaim) Validate() error { return nil } +// Validate checks if a ClaimType is valid +func (ct ClaimType) Validate() error { + switch ct { + case CLAIM_TYPE_HARD_BORROW, + CLAIM_TYPE_HARD_SUPPLY, + CLAIM_TYPE_DELEGATOR, + CLAIM_TYPE_EARN, + CLAIM_TYPE_SAVINGS, + CLAIM_TYPE_SWAP, + CLAIM_TYPE_USDX_MINTING: + return nil + default: + return fmt.Errorf("invalid claim type: %v", ct) + } +} + +// NewClaim returns a new Claim +func NewClaim( + claimType ClaimType, + owner sdk.AccAddress, + reward sdk.Coins, + rewardIndexes MultiRewardIndexes, +) Claim { + return Claim{ + Type: claimType, + Owner: owner, + Reward: reward, + RewardIndexes: rewardIndexes, + } +} + +// Validate performs a basic check of a Claim +func (c Claim) Validate() error { + if err := c.Type.Validate(); err != nil { + return err + } + + if c.Owner.Empty() { + return errors.New("claim owner cannot be empty") + } + + if err := c.Reward.Validate(); err != nil { + return fmt.Errorf("invalid reward amount %v: %w", c.Reward, err) + } + + if err := c.RewardIndexes.Validate(); err != nil { + return fmt.Errorf("invalid reward indexes: %w", err) + } + + return nil +} + // NewUSDXMintingClaim returns a new USDXMintingClaim func NewUSDXMintingClaim(owner sdk.AccAddress, reward sdk.Coin, rewardIndexes RewardIndexes) USDXMintingClaim { return USDXMintingClaim{ diff --git a/x/incentive/types/claims.pb.go b/x/incentive/types/claims.pb.go index 77839b79..47dad5e6 100644 --- a/x/incentive/types/claims.pb.go +++ b/x/incentive/types/claims.pb.go @@ -26,6 +26,50 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ClaimType is the type of claim +type ClaimType int32 + +const ( + CLAIM_TYPE_UNSPECIFIED ClaimType = 0 + CLAIM_TYPE_HARD_BORROW ClaimType = 1 + CLAIM_TYPE_HARD_SUPPLY ClaimType = 2 + CLAIM_TYPE_DELEGATOR ClaimType = 3 + CLAIM_TYPE_EARN ClaimType = 4 + CLAIM_TYPE_SAVINGS ClaimType = 5 + CLAIM_TYPE_SWAP ClaimType = 6 + CLAIM_TYPE_USDX_MINTING ClaimType = 7 +) + +var ClaimType_name = map[int32]string{ + 0: "CLAIM_TYPE_UNSPECIFIED", + 1: "CLAIM_TYPE_HARD_BORROW", + 2: "CLAIM_TYPE_HARD_SUPPLY", + 3: "CLAIM_TYPE_DELEGATOR", + 4: "CLAIM_TYPE_EARN", + 5: "CLAIM_TYPE_SAVINGS", + 6: "CLAIM_TYPE_SWAP", + 7: "CLAIM_TYPE_USDX_MINTING", +} + +var ClaimType_value = map[string]int32{ + "CLAIM_TYPE_UNSPECIFIED": 0, + "CLAIM_TYPE_HARD_BORROW": 1, + "CLAIM_TYPE_HARD_SUPPLY": 2, + "CLAIM_TYPE_DELEGATOR": 3, + "CLAIM_TYPE_EARN": 4, + "CLAIM_TYPE_SAVINGS": 5, + "CLAIM_TYPE_SWAP": 6, + "CLAIM_TYPE_USDX_MINTING": 7, +} + +func (x ClaimType) String() string { + return proto.EnumName(ClaimType_name, int32(x)) +} + +func (ClaimType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5f7515029623a895, []int{0} +} + // BaseClaim is a claim with a single reward coin types type BaseClaim struct { Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,1,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` @@ -493,7 +537,49 @@ func (m *EarnClaim) XXX_DiscardUnknown() { var xxx_messageInfo_EarnClaim proto.InternalMessageInfo +// Claim stores any generic rewards that can be claimed by owner +type Claim struct { + Type ClaimType `protobuf:"varint,1,opt,name=type,proto3,enum=kava.incentive.v1beta1.ClaimType" json:"type,omitempty"` + Owner github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,2,opt,name=owner,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"owner,omitempty"` + Reward github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=reward,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward"` + RewardIndexes MultiRewardIndexes `protobuf:"bytes,4,rep,name=reward_indexes,json=rewardIndexes,proto3,castrepeated=MultiRewardIndexes" json:"reward_indexes"` +} + +func (m *Claim) Reset() { *m = Claim{} } +func (m *Claim) String() string { return proto.CompactTextString(m) } +func (*Claim) ProtoMessage() {} +func (*Claim) Descriptor() ([]byte, []int) { + return fileDescriptor_5f7515029623a895, []int{12} +} +func (m *Claim) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Claim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Claim.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 *Claim) XXX_Merge(src proto.Message) { + xxx_messageInfo_Claim.Merge(m, src) +} +func (m *Claim) XXX_Size() int { + return m.Size() +} +func (m *Claim) XXX_DiscardUnknown() { + xxx_messageInfo_Claim.DiscardUnknown(m) +} + +var xxx_messageInfo_Claim proto.InternalMessageInfo + func init() { + proto.RegisterEnum("kava.incentive.v1beta1.ClaimType", ClaimType_name, ClaimType_value) proto.RegisterType((*BaseClaim)(nil), "kava.incentive.v1beta1.BaseClaim") proto.RegisterType((*BaseMultiClaim)(nil), "kava.incentive.v1beta1.BaseMultiClaim") proto.RegisterType((*RewardIndex)(nil), "kava.incentive.v1beta1.RewardIndex") @@ -506,6 +592,7 @@ func init() { proto.RegisterType((*SwapClaim)(nil), "kava.incentive.v1beta1.SwapClaim") proto.RegisterType((*SavingsClaim)(nil), "kava.incentive.v1beta1.SavingsClaim") proto.RegisterType((*EarnClaim)(nil), "kava.incentive.v1beta1.EarnClaim") + proto.RegisterType((*Claim)(nil), "kava.incentive.v1beta1.Claim") } func init() { @@ -513,51 +600,61 @@ func init() { } var fileDescriptor_5f7515029623a895 = []byte{ - // 693 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x96, 0x4f, 0x4f, 0x13, 0x4d, - 0x1c, 0xc7, 0x3b, 0xf0, 0x40, 0x9e, 0x0e, 0xa5, 0x0f, 0x59, 0xe0, 0x11, 0x7a, 0xd8, 0x62, 0x49, - 0xb0, 0x89, 0xe9, 0xae, 0xe0, 0xc1, 0xc4, 0x1b, 0x0b, 0x1a, 0x30, 0x12, 0xc9, 0x56, 0x13, 0xe3, - 0xc1, 0x66, 0x76, 0x77, 0xac, 0x13, 0xb6, 0x3b, 0x75, 0x66, 0xdb, 0xd2, 0xd7, 0xe0, 0x45, 0xdf, - 0x80, 0x2f, 0xc0, 0x8b, 0x17, 0x5e, 0x04, 0x31, 0x1e, 0x88, 0x31, 0xf1, 0xcf, 0xa1, 0x22, 0x5c, - 0x7d, 0x05, 0x9e, 0xcc, 0xfc, 0x01, 0x16, 0x68, 0x09, 0x31, 0xc5, 0x03, 0xa7, 0xdd, 0xf9, 0xcd, - 0x6f, 0x7f, 0xdf, 0xcf, 0xef, 0x3b, 0xb3, 0xb3, 0x0b, 0x67, 0x37, 0x50, 0x13, 0xd9, 0x24, 0xf2, - 0x71, 0x14, 0x93, 0x26, 0xb6, 0x9b, 0x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9d, 0xbd, 0x99, 0xf8, 0x6b, 0x94, - 0x1f, 0x6b, 0x6f, 0x58, 0xfe, 0xc4, 0xdd, 0xfc, 0x1d, 0x00, 0x00, 0xff, 0xff, 0xb3, 0x1b, 0x3b, - 0x5a, 0x54, 0x0a, 0x00, 0x00, + // 849 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x57, 0x4d, 0x6f, 0xf3, 0x44, + 0x10, 0xce, 0x26, 0x69, 0x21, 0xdb, 0xbc, 0xa9, 0xe5, 0x7e, 0xa5, 0x41, 0x72, 0x4a, 0x2a, 0x95, + 0x08, 0x14, 0x87, 0x16, 0x21, 0xce, 0x76, 0x92, 0xb6, 0x46, 0xf9, 0x92, 0x9d, 0xd2, 0x96, 0x03, + 0xd6, 0xc6, 0x5e, 0x82, 0x55, 0xc7, 0x1b, 0x6c, 0x27, 0x69, 0xfe, 0x01, 0x12, 0x17, 0xf8, 0x03, + 0x5c, 0xe0, 0xc4, 0x99, 0x3f, 0xc0, 0xad, 0x48, 0x08, 0x55, 0x48, 0x48, 0x88, 0x43, 0xa0, 0xed, + 0x1f, 0xe0, 0xcc, 0x09, 0xf9, 0xa3, 0xa9, 0x9b, 0x26, 0x55, 0xf5, 0x2a, 0xe9, 0xa1, 0xa7, 0xec, + 0xce, 0x8c, 0xe7, 0x79, 0xe6, 0x99, 0xf1, 0x7a, 0x03, 0xb7, 0xcf, 0x50, 0x0f, 0xe5, 0x35, 0x43, + 0xc1, 0x86, 0xad, 0xf5, 0x70, 0xbe, 0xb7, 0xdb, 0xc4, 0x36, 0xda, 0xcd, 0x2b, 0x3a, 0xd2, 0xda, + 0x16, 0xdb, 0x31, 0x89, 0x4d, 0xe8, 0x75, 0x27, 0x88, 0x1d, 0x05, 0xb1, 0x7e, 0x50, 0x6a, 0xb5, + 0x45, 0x5a, 0xc4, 0x0d, 0xc9, 0x3b, 0x2b, 0x2f, 0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3, 0x1d, 0x72, 0x62, 0x51, 0xe6, 0x6b, 0xa2, 0x58, + 0x3b, 0xa6, 0xc0, 0x24, 0x9f, 0x74, 0x54, 0xaf, 0x97, 0x4f, 0xa9, 0x30, 0x9d, 0x84, 0xab, 0x01, + 0x5f, 0xb1, 0x54, 0x2e, 0x1d, 0x70, 0x8d, 0x9a, 0x48, 0x45, 0xe8, 0x15, 0xb8, 0x1c, 0xf0, 0x94, + 0x38, 0xb1, 0x4a, 0x45, 0xe9, 0x75, 0x48, 0x07, 0x8c, 0x12, 0xf7, 0x89, 0x50, 0x3d, 0x90, 0xa8, + 0x85, 0xb1, 0x60, 0xe9, 0x98, 0xab, 0x53, 0x8b, 0xf4, 0x5b, 0x70, 0x23, 0xc8, 0x57, 0x2a, 0x9e, + 0xc8, 0x15, 0xa1, 0xda, 0x10, 0xaa, 0x07, 0xd4, 0x1b, 0xa9, 0xe8, 0x57, 0xdf, 0x33, 0x21, 0x5e, + 0xb8, 0xb8, 0x62, 0x42, 0x17, 0xd7, 0x0c, 0xb8, 0xbc, 0x66, 0xc0, 0x3f, 0xd7, 0x0c, 0xf8, 0xe6, + 0x86, 0x09, 0x5d, 0xde, 0x30, 0xa1, 0x3f, 0x6f, 0x98, 0xd0, 0xa7, 0xef, 0x05, 0xba, 0xe3, 0xa8, + 0x9b, 0xd3, 0x51, 0xd3, 0x72, 0x57, 0xf9, 0xf3, 0xc0, 0x3f, 0x06, 0xb7, 0x4d, 0xcd, 0x45, 0xf7, + 0x02, 0xff, 0xc1, 0xff, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa4, 0x35, 0x3f, 0x49, 0x50, 0x0c, 0x00, + 0x00, } func (m *BaseClaim) Marshal() (dAtA []byte, err error) { @@ -1098,6 +1195,69 @@ func (m *EarnClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *Claim) 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 *Claim) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Claim) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.RewardIndexes) > 0 { + for iNdEx := len(m.RewardIndexes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardIndexes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintClaims(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Reward) > 0 { + for iNdEx := len(m.Reward) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Reward[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintClaims(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Owner) > 0 { + i -= len(m.Owner) + copy(dAtA[i:], m.Owner) + i = encodeVarintClaims(dAtA, i, uint64(len(m.Owner))) + i-- + dAtA[i] = 0x12 + } + if m.Type != 0 { + i = encodeVarintClaims(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintClaims(dAtA []byte, offset int, v uint64) int { offset -= sovClaims(v) base := offset @@ -1315,6 +1475,34 @@ func (m *EarnClaim) Size() (n int) { return n } +func (m *Claim) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Type != 0 { + n += 1 + sovClaims(uint64(m.Type)) + } + l = len(m.Owner) + if l > 0 { + n += 1 + l + sovClaims(uint64(l)) + } + if len(m.Reward) > 0 { + for _, e := range m.Reward { + l = e.Size() + n += 1 + l + sovClaims(uint64(l)) + } + } + if len(m.RewardIndexes) > 0 { + for _, e := range m.RewardIndexes { + l = e.Size() + n += 1 + l + sovClaims(uint64(l)) + } + } + return n +} + func sovClaims(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2691,6 +2879,177 @@ func (m *EarnClaim) Unmarshal(dAtA []byte) error { } return nil } +func (m *Claim) 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 ErrIntOverflowClaims + } + 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: Claim: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Claim: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) + } + m.Type = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClaims + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Type |= ClaimType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Owner", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClaims + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthClaims + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthClaims + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Owner = append(m.Owner[:0], dAtA[iNdEx:postIndex]...) + if m.Owner == nil { + m.Owner = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Reward", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClaims + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClaims + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthClaims + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Reward = append(m.Reward, types.Coin{}) + if err := m.Reward[len(m.Reward)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardIndexes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowClaims + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthClaims + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthClaims + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardIndexes = append(m.RewardIndexes, MultiRewardIndex{}) + if err := m.RewardIndexes[len(m.RewardIndexes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipClaims(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthClaims + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipClaims(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0