Add savings claim types to incentive module (#1204)

* define and generate proto types

* implement savings claim msg + test

* implement savings claim + test

* register msg and add store keys

* implement savings claim keeper methods

* update function comment
This commit is contained in:
Denali Marsh 2022-04-01 16:17:03 +02:00 committed by GitHub
parent 9a389203c3
commit fc3f0cfd2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1051 additions and 74 deletions

View File

@ -248,6 +248,7 @@
- [MultiRewardIndexesProto](#kava.incentive.v1beta1.MultiRewardIndexesProto)
- [RewardIndex](#kava.incentive.v1beta1.RewardIndex)
- [RewardIndexesProto](#kava.incentive.v1beta1.RewardIndexesProto)
- [SavingsClaim](#kava.incentive.v1beta1.SavingsClaim)
- [SwapClaim](#kava.incentive.v1beta1.SwapClaim)
- [USDXMintingClaim](#kava.incentive.v1beta1.USDXMintingClaim)
@ -268,6 +269,8 @@
- [MsgClaimDelegatorRewardResponse](#kava.incentive.v1beta1.MsgClaimDelegatorRewardResponse)
- [MsgClaimHardReward](#kava.incentive.v1beta1.MsgClaimHardReward)
- [MsgClaimHardRewardResponse](#kava.incentive.v1beta1.MsgClaimHardRewardResponse)
- [MsgClaimSavingsReward](#kava.incentive.v1beta1.MsgClaimSavingsReward)
- [MsgClaimSavingsRewardResponse](#kava.incentive.v1beta1.MsgClaimSavingsRewardResponse)
- [MsgClaimSwapReward](#kava.incentive.v1beta1.MsgClaimSwapReward)
- [MsgClaimSwapRewardResponse](#kava.incentive.v1beta1.MsgClaimSwapRewardResponse)
- [MsgClaimUSDXMintingReward](#kava.incentive.v1beta1.MsgClaimUSDXMintingReward)
@ -3687,6 +3690,22 @@ RewardIndexesProto defines a Protobuf wrapper around a RewardIndexes slice
<a name="kava.incentive.v1beta1.SavingsClaim"></a>
### SavingsClaim
SavingsClaim stores the savings rewards that can be claimed by owner
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `base_claim` | [BaseMultiClaim](#kava.incentive.v1beta1.BaseMultiClaim) | | |
| `reward_indexes` | [MultiRewardIndex](#kava.incentive.v1beta1.MultiRewardIndex) | repeated | |
<a name="kava.incentive.v1beta1.SwapClaim"></a>
### SwapClaim
@ -3968,6 +3987,32 @@ MsgClaimHardRewardResponse defines the Msg/ClaimHardReward response type.
<a name="kava.incentive.v1beta1.MsgClaimSavingsReward"></a>
### MsgClaimSavingsReward
MsgClaimSavingsReward message type used to claim savings rewards
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `sender` | [string](#string) | | |
| `denoms_to_claim` | [Selection](#kava.incentive.v1beta1.Selection) | repeated | |
<a name="kava.incentive.v1beta1.MsgClaimSavingsRewardResponse"></a>
### MsgClaimSavingsRewardResponse
MsgClaimSavingsRewardResponse defines the Msg/ClaimSavingsReward response type.
<a name="kava.incentive.v1beta1.MsgClaimSwapReward"></a>
### MsgClaimSwapReward
@ -4054,6 +4099,7 @@ Msg defines the incentive Msg service.
| `ClaimHardReward` | [MsgClaimHardReward](#kava.incentive.v1beta1.MsgClaimHardReward) | [MsgClaimHardRewardResponse](#kava.incentive.v1beta1.MsgClaimHardRewardResponse) | ClaimHardReward is a message type used to claim Hard liquidity provider rewards | |
| `ClaimDelegatorReward` | [MsgClaimDelegatorReward](#kava.incentive.v1beta1.MsgClaimDelegatorReward) | [MsgClaimDelegatorRewardResponse](#kava.incentive.v1beta1.MsgClaimDelegatorRewardResponse) | ClaimDelegatorReward is a message type used to claim delegator rewards | |
| `ClaimSwapReward` | [MsgClaimSwapReward](#kava.incentive.v1beta1.MsgClaimSwapReward) | [MsgClaimSwapRewardResponse](#kava.incentive.v1beta1.MsgClaimSwapRewardResponse) | ClaimSwapReward is a message type used to claim delegator rewards | |
| `ClaimSavingsReward` | [MsgClaimSavingsReward](#kava.incentive.v1beta1.MsgClaimSavingsReward) | [MsgClaimSavingsRewardResponse](#kava.incentive.v1beta1.MsgClaimSavingsRewardResponse) | ClaimSavingsReward is a message type used to claim savings rewards | |
<!-- end services -->

View File

@ -105,3 +105,13 @@ message SwapClaim {
repeated MultiRewardIndex reward_indexes = 2
[(gogoproto.castrepeated) = "MultiRewardIndexes", (gogoproto.nullable) = false];
}
// 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
[(gogoproto.castrepeated) = "MultiRewardIndexes", (gogoproto.nullable) = false];
}

View File

@ -18,6 +18,9 @@ service Msg {
// ClaimSwapReward is a message type used to claim delegator rewards
rpc ClaimSwapReward(MsgClaimSwapReward) returns (MsgClaimSwapRewardResponse);
// ClaimSavingsReward is a message type used to claim savings rewards
rpc ClaimSavingsReward(MsgClaimSavingsReward) returns (MsgClaimSavingsRewardResponse);
}
// Selection is a pair of denom and multiplier name. It holds the choice of multiplier a user makes when they claim a
@ -77,3 +80,15 @@ message MsgClaimSwapReward {
// MsgClaimSwapRewardResponse defines the Msg/ClaimSwapReward response type.
message MsgClaimSwapRewardResponse {}
// MsgClaimSavingsReward message type used to claim savings rewards
message MsgClaimSavingsReward {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;
string sender = 1;
repeated Selection denoms_to_claim = 2 [(gogoproto.castrepeated) = "Selections", (gogoproto.nullable) = false];
}
// MsgClaimSavingsRewardResponse defines the Msg/ClaimSavingsReward response type.
message MsgClaimSavingsRewardResponse {}

View File

@ -207,3 +207,9 @@ func (k Keeper) ClaimSwapReward(ctx sdk.Context, owner, receiver sdk.AccAddress,
)
return nil
}
// ClaimSavingsReward is a stub method for MsgServer interface compliance
func (k Keeper) ClaimSavingsReward(ctx sdk.Context, owner, receiver sdk.AccAddress, denom string, multiplierName string) error {
// TODO: implement savings claim logic
return nil
}

View File

@ -323,6 +323,55 @@ func (k Keeper) GetAllSwapClaims(ctx sdk.Context) types.SwapClaims {
return cs
}
// GetSavingsClaim returns the claim in the store corresponding the the input address.
func (k Keeper) GetSavingsClaim(ctx sdk.Context, addr sdk.AccAddress) (types.SavingsClaim, bool) {
store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsClaimKeyPrefix)
bz := store.Get(addr)
if bz == nil {
return types.SavingsClaim{}, false
}
var c types.SavingsClaim
k.cdc.MustUnmarshal(bz, &c)
return c, true
}
// SetSavingsClaim sets the claim in the store corresponding to the input address.
func (k Keeper) SetSavingsClaim(ctx sdk.Context, c types.SavingsClaim) {
store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsClaimKeyPrefix)
bz := k.cdc.MustMarshal(&c)
store.Set(c.Owner, bz)
}
// DeleteSavingsClaim deletes the claim in the store corresponding to the input address.
func (k Keeper) DeleteSavingsClaim(ctx sdk.Context, owner sdk.AccAddress) {
store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsClaimKeyPrefix)
store.Delete(owner)
}
// IterateSavingsClaims iterates over all savings claim objects in the store and preforms a callback function
func (k Keeper) IterateSavingsClaims(ctx sdk.Context, cb func(c types.SavingsClaim) (stop bool)) {
store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsClaimKeyPrefix)
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var c types.SavingsClaim
k.cdc.MustUnmarshal(iterator.Value(), &c)
if cb(c) {
break
}
}
}
// GetAllSavingsClaims returns all savings claim objects in the store
func (k Keeper) GetAllSavingsClaims(ctx sdk.Context) types.SavingsClaims {
cs := types.SavingsClaims{}
k.IterateSavingsClaims(ctx, func(c types.SavingsClaim) (stop bool) {
cs = append(cs, c)
return false
})
return cs
}
// SetHardSupplyRewardIndexes sets the current reward indexes for an individual denom
func (k Keeper) SetHardSupplyRewardIndexes(ctx sdk.Context, denom string, indexes types.RewardIndexes) {
store := prefix.NewStore(ctx.KVStore(k.key), types.HardSupplyRewardIndexesKeyPrefix)
@ -621,3 +670,78 @@ func (k Keeper) IterateSwapRewardAccrualTimes(ctx sdk.Context, cb func(string, t
}
}
}
// SetSavingsRewardIndexes stores the global reward indexes that rewards for an individual denom type
func (k Keeper) SetSavingsRewardIndexes(ctx sdk.Context, denom string, indexes types.RewardIndexes) {
store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsRewardIndexesKeyPrefix)
bz := k.cdc.MustMarshal(&types.RewardIndexesProto{
RewardIndexes: indexes,
})
store.Set([]byte(denom), bz)
}
// GetSavingsRewardIndexes fetches the global reward indexes that track rewards for an individual denom type
func (k Keeper) GetSavingsRewardIndexes(ctx sdk.Context, denom string) (types.RewardIndexes, bool) {
store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsRewardIndexesKeyPrefix)
bz := store.Get([]byte(denom))
if bz == nil {
return types.RewardIndexes{}, false
}
var proto types.RewardIndexesProto
k.cdc.MustUnmarshal(bz, &proto)
return proto.RewardIndexes, true
}
// IterateSavingsRewardIndexes iterates over all savings reward index objects in the store and preforms a callback function
func (k Keeper) IterateSavingsRewardIndexes(ctx sdk.Context, cb func(poolID string, indexes types.RewardIndexes) (stop bool)) {
store := prefix.NewStore(ctx.KVStore(k.key), types.SavingsRewardIndexesKeyPrefix)
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
var proto types.RewardIndexesProto
k.cdc.MustUnmarshal(iterator.Value(), &proto)
if cb(string(iterator.Key()), proto.RewardIndexes) {
break
}
}
}
// GetSavingsRewardAccrualTime fetches the last time rewards were accrued for an individual denom type
func (k Keeper) GetSavingsRewardAccrualTime(ctx sdk.Context, poolID string) (blockTime time.Time, found bool) {
store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousSavingsRewardAccrualTimeKeyPrefix)
b := store.Get([]byte(poolID))
if b == nil {
return time.Time{}, false
}
if err := blockTime.UnmarshalBinary(b); err != nil {
panic(err)
}
return blockTime, true
}
// SetSavingsRewardAccrualTime stores the last time rewards were accrued for a savings deposit denom type
func (k Keeper) SetSavingsRewardAccrualTime(ctx sdk.Context, poolID string, blockTime time.Time) {
store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousSavingsRewardAccrualTimeKeyPrefix)
bz, err := blockTime.MarshalBinary()
if err != nil {
panic(err)
}
store.Set([]byte(poolID), bz)
}
// IterateSavingsRewardAccrualTimesiterates over all the previous savings reward accrual times in the store
func (k Keeper) IterateSavingsRewardAccrualTimes(ctx sdk.Context, cb func(string, time.Time) (stop bool)) {
store := prefix.NewStore(ctx.KVStore(k.key), types.PreviousSavingsRewardAccrualTimeKeyPrefix)
iterator := sdk.KVStorePrefixIterator(store, []byte{})
defer iterator.Close()
for ; iterator.Valid(); iterator.Next() {
poolID := string(iterator.Key())
var accrualTime time.Time
if err := accrualTime.UnmarshalBinary(iterator.Value()); err != nil {
panic(err)
}
if cb(poolID, accrualTime) {
break
}
}
}

View File

@ -90,3 +90,21 @@ func (k msgServer) ClaimSwapReward(goCtx context.Context, msg *types.MsgClaimSwa
return &types.MsgClaimSwapRewardResponse{}, nil
}
func (k msgServer) ClaimSavingsReward(goCtx context.Context, msg *types.MsgClaimSavingsReward) (*types.MsgClaimSavingsRewardResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
sender, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
return nil, err
}
for _, selection := range msg.DenomsToClaim {
err := k.keeper.ClaimSavingsReward(ctx, sender, sender, selection.Denom, selection.MultiplierName)
if err != nil {
return nil, err
}
}
return &types.MsgClaimSavingsRewardResponse{}, nil
}

View File

@ -13,6 +13,7 @@ const (
HardLiquidityProviderClaimType = "hard_liquidity_provider"
DelegatorClaimType = "delegator_claim"
SwapClaimType = "swap"
SavingsClaimType = "savings"
)
// GetOwner is a getter for Claim Owner
@ -285,6 +286,58 @@ func (cs SwapClaims) Validate() error {
return nil
}
// NewSavingsClaim returns a new SavingsClaim
func NewSavingsClaim(owner sdk.AccAddress, rewards sdk.Coins, rewardIndexes MultiRewardIndexes) SavingsClaim {
return SavingsClaim{
BaseMultiClaim: BaseMultiClaim{
Owner: owner,
Reward: rewards,
},
RewardIndexes: rewardIndexes,
}
}
// GetType returns the claim's type
func (c SavingsClaim) GetType() string { return SavingsClaimType }
// GetReward returns the claim's reward coin
func (c SavingsClaim) GetReward() sdk.Coins { return c.Reward }
// GetOwner returns the claim's owner
func (c SavingsClaim) GetOwner() sdk.AccAddress { return c.Owner }
// Validate performs a basic check of a SavingsClaim fields
func (c SavingsClaim) Validate() error {
if err := c.RewardIndexes.Validate(); err != nil {
return err
}
return c.BaseMultiClaim.Validate()
}
// HasRewardIndex check if a claim has a reward index for the input denom
func (c SavingsClaim) HasRewardIndex(denom string) (int64, bool) {
for index, ri := range c.RewardIndexes {
if ri.CollateralType == denom {
return int64(index), true
}
}
return 0, false
}
// SavingsClaims slice of SavingsClaim
type SavingsClaims []SavingsClaim
// Validate checks if all the claims are valid.
func (cs SavingsClaims) Validate() error {
for _, c := range cs {
if err := c.Validate(); err != nil {
return err
}
}
return nil
}
// ---------------------- Reward indexes are used internally in the store ----------------------
// NewRewardIndex returns a new RewardIndex

View File

@ -415,6 +415,45 @@ func (m *SwapClaim) XXX_DiscardUnknown() {
var xxx_messageInfo_SwapClaim proto.InternalMessageInfo
// SavingsClaim stores the savings rewards that can be claimed by owner
type SavingsClaim struct {
BaseMultiClaim `protobuf:"bytes,1,opt,name=base_claim,json=baseClaim,proto3,embedded=base_claim" json:"base_claim"`
RewardIndexes MultiRewardIndexes `protobuf:"bytes,2,rep,name=reward_indexes,json=rewardIndexes,proto3,castrepeated=MultiRewardIndexes" json:"reward_indexes"`
}
func (m *SavingsClaim) Reset() { *m = SavingsClaim{} }
func (m *SavingsClaim) String() string { return proto.CompactTextString(m) }
func (*SavingsClaim) ProtoMessage() {}
func (*SavingsClaim) Descriptor() ([]byte, []int) {
return fileDescriptor_5f7515029623a895, []int{10}
}
func (m *SavingsClaim) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *SavingsClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_SavingsClaim.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 *SavingsClaim) XXX_Merge(src proto.Message) {
xxx_messageInfo_SavingsClaim.Merge(m, src)
}
func (m *SavingsClaim) XXX_Size() int {
return m.Size()
}
func (m *SavingsClaim) XXX_DiscardUnknown() {
xxx_messageInfo_SavingsClaim.DiscardUnknown(m)
}
var xxx_messageInfo_SavingsClaim proto.InternalMessageInfo
func init() {
proto.RegisterType((*BaseClaim)(nil), "kava.incentive.v1beta1.BaseClaim")
proto.RegisterType((*BaseMultiClaim)(nil), "kava.incentive.v1beta1.BaseMultiClaim")
@ -426,6 +465,7 @@ func init() {
proto.RegisterType((*HardLiquidityProviderClaim)(nil), "kava.incentive.v1beta1.HardLiquidityProviderClaim")
proto.RegisterType((*DelegatorClaim)(nil), "kava.incentive.v1beta1.DelegatorClaim")
proto.RegisterType((*SwapClaim)(nil), "kava.incentive.v1beta1.SwapClaim")
proto.RegisterType((*SavingsClaim)(nil), "kava.incentive.v1beta1.SavingsClaim")
}
func init() {
@ -433,50 +473,50 @@ func init() {
}
var fileDescriptor_5f7515029623a895 = []byte{
// 673 bytes of a gzipped FileDescriptorProto
// 686 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x96, 0x4f, 0x4f, 0x13, 0x4f,
0x18, 0xc7, 0x3b, 0xf0, 0x83, 0xfc, 0x3a, 0x40, 0x25, 0x0b, 0x28, 0xf4, 0xb0, 0xc5, 0x92, 0x60,
0x13, 0xd3, 0x5d, 0xc1, 0x83, 0x89, 0x37, 0x16, 0x62, 0xc0, 0x48, 0x24, 0x8b, 0x26, 0xc6, 0x83,
0xcd, 0xec, 0xee, 0x58, 0x27, 0x6c, 0x77, 0xea, 0xce, 0xb4, 0xa5, 0xaf, 0xc1, 0x8b, 0xbe, 0x01,
0x5f, 0x80, 0x17, 0x2f, 0xbc,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0x78, 0x40, 0x5e, 0x36, 0x48, 0x40, 0x78, 0x7b, 0x3d, 0xa6, 0x4d,
0x12, 0xe0, 0x58, 0xc1, 0x3c, 0xec, 0xd2, 0xd8, 0xdc, 0x59, 0x8d, 0x1d, 0x9d, 0x1a, 0xdd, 0xbb,
0xdb, 0x84, 0x93, 0xac, 0x51, 0xaf, 0x87, 0xed, 0x4a, 0xd7, 0x26, 0xfb, 0x73, 0xdf, 0xc6, 0x95,
0xc4, 0xb1, 0xa0, 0x50, 0xf6, 0x68, 0x1c, 0xd3, 0xd6, 0x49, 0xe5, 0xc1, 0x7e, 0x2a, 0x2b, 0x09,
0xb7, 0x97, 0xdd, 0xdf, 0x00, 0xcc, 0x2e, 0xe3, 0x10, 0x57, 0x11, 0xa7, 0x17, 0x65, 0xf1, 0x46,
0x8f, 0x01, 0xea, 0x4f, 0x87, 0xbd, 0x47, 0xe9, 0x33, 0x80, 0xe9, 0x72, 0x0b, 0xd5, 0x2f, 0x59,
0x5b, 0x5f, 0x00, 0xcc, 0x94, 0x51, 0x93, 0x44, 0x55, 0x76, 0xb9, 0x3a, 0x73, 0x56, 0xb7, 0x7f,
0x9a, 0xa9, 0xed, 0x3d, 0x13, 0xec, 0xec, 0x99, 0x60, 0x77, 0xcf, 0x04, 0xaf, 0xf7, 0xcd, 0xd4,
0xce, 0xbe, 0x99, 0xfa, 0xba, 0x6f, 0xa6, 0x9e, 0xde, 0x4c, 0xbc, 0xcc, 0x04, 0x47, 0x29, 0x44,
0x1e, 0x93, 0xff, 0xec, 0xcd, 0xc4, 0xe7, 0x95, 0x7c, 0xab, 0x79, 0xc3, 0xf2, 0x6b, 0xe7, 0xf6,
0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x6c, 0x47, 0x50, 0x7d, 0x09, 0x00, 0x00,
}
func (m *BaseClaim) Marshal() (dAtA []byte, err error) {
@ -923,6 +963,53 @@ func (m *SwapClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) {
return len(dAtA) - i, nil
}
func (m *SavingsClaim) 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 *SavingsClaim) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *SavingsClaim) 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] = 0x12
}
}
{
size, err := m.BaseMultiClaim.MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintClaims(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0xa
return len(dAtA) - i, nil
}
func encodeVarintClaims(dAtA []byte, offset int, v uint64) int {
offset -= sovClaims(v)
base := offset
@ -1106,6 +1193,23 @@ func (m *SwapClaim) Size() (n int) {
return n
}
func (m *SavingsClaim) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = m.BaseMultiClaim.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
}
@ -2248,6 +2352,123 @@ func (m *SwapClaim) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *SavingsClaim) 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: SavingsClaim: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: SavingsClaim: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field BaseMultiClaim", 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
}
if err := m.BaseMultiClaim.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 2:
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

View File

@ -137,6 +137,60 @@ func TestClaims_Validate(t *testing.T) {
})
}
})
t.Run("SavingsClaims", func(t *testing.T) {
validRewardIndexes := RewardIndexes{}.With("ukava", d("0.002"))
validMultiRewardIndexes := MultiRewardIndexes{}.With("btcb/usdx", validRewardIndexes)
invalidRewardIndexes := RewardIndexes{}.With("ukava", d("-0.002"))
invalidMultiRewardIndexes := MultiRewardIndexes{}.With("btcb/usdx", invalidRewardIndexes)
testCases := []struct {
name string
claims SavingsClaims
expPass bool
}{
{
name: "valid",
claims: SavingsClaims{
NewSavingsClaim(owner, cs(c("bnb", 1)), validMultiRewardIndexes),
},
expPass: true,
},
{
name: "invalid owner",
claims: SavingsClaims{
NewSavingsClaim(nil, cs(c("bnb", 1)), validMultiRewardIndexes),
},
expPass: false,
},
{
name: "invalid reward",
claims: SavingsClaims{
NewSavingsClaim(owner, sdk.Coins{sdk.Coin{Denom: "invalid😫"}}, validMultiRewardIndexes),
},
expPass: false,
},
{
name: "invalid indexes",
claims: SavingsClaims{
NewSavingsClaim(nil, cs(c("bnb", 1)), invalidMultiRewardIndexes),
},
expPass: false,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
err := tc.claims.Validate()
if tc.expPass {
require.NoError(t, err)
} else {
require.Error(t, err)
}
})
}
})
}
func TestRewardIndexes(t *testing.T) {

View File

@ -16,6 +16,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgClaimHardReward{}, "incentive/MsgClaimHardReward", nil)
cdc.RegisterConcrete(&MsgClaimDelegatorReward{}, "incentive/MsgClaimDelegatorReward", nil)
cdc.RegisterConcrete(&MsgClaimSwapReward{}, "incentive/MsgClaimSwapReward", nil)
cdc.RegisterConcrete(&MsgClaimSavingsReward{}, "incentive/MsgClaimSavingsReward", nil)
}
func RegisterInterfaces(registry types.InterfaceRegistry) {
@ -24,6 +25,7 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
&MsgClaimHardReward{},
&MsgClaimDelegatorReward{},
&MsgClaimSwapReward{},
&MsgClaimSavingsReward{},
)
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)

View File

@ -33,4 +33,7 @@ var (
SwapClaimKeyPrefix = []byte{0x12} // prefix for keys that store swap claims
SwapRewardIndexesKeyPrefix = []byte{0x13} // prefix for key that stores swap reward indexes
PreviousSwapRewardAccrualTimeKeyPrefix = []byte{0x14} // prefix for key that stores the previous time swap rewards accrued
SavingsClaimKeyPrefix = []byte{0x15} // prefix for keys that store savings claims
SavingsRewardIndexesKeyPrefix = []byte{0x16} // prefix for key that stores savings reward indexes
PreviousSavingsRewardAccrualTimeKeyPrefix = []byte{0x17} // prefix for key that stores the previous time savings rewards accrued
)

View File

@ -12,6 +12,7 @@ var _ sdk.Msg = &MsgClaimUSDXMintingReward{}
var _ sdk.Msg = &MsgClaimHardReward{}
var _ sdk.Msg = &MsgClaimDelegatorReward{}
var _ sdk.Msg = &MsgClaimSwapReward{}
var _ sdk.Msg = &MsgClaimSavingsReward{}
// NewMsgClaimUSDXMintingReward returns a new MsgClaimUSDXMintingReward.
func NewMsgClaimUSDXMintingReward(sender string, multiplierName string) MsgClaimUSDXMintingReward {
@ -182,3 +183,46 @@ func (msg MsgClaimSwapReward) GetSigners() []sdk.AccAddress {
}
return []sdk.AccAddress{sender}
}
// NewMsgClaimSavingsReward returns a new MsgClaimSavingsReward.
func NewMsgClaimSavingsReward(sender string, denomsToClaim Selections) MsgClaimSavingsReward {
return MsgClaimSavingsReward{
Sender: sender,
DenomsToClaim: denomsToClaim,
}
}
// Route return the message type used for routing the message.
func (msg MsgClaimSavingsReward) Route() string { return RouterKey }
// Type returns a human-readable string for the message, intended for utilization within tags.
func (msg MsgClaimSavingsReward) Type() string {
return "claim_savings_reward"
}
// ValidateBasic does a simple validation check that doesn't require access to state.
func (msg MsgClaimSavingsReward) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
return sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, "sender address cannot be empty or invalid")
}
if err := msg.DenomsToClaim.Validate(); err != nil {
return err
}
return nil
}
// GetSignBytes gets the canonical byte representation of the Msg.
func (msg MsgClaimSavingsReward) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(&msg)
return sdk.MustSortJSON(bz)
}
// GetSigners returns the addresses of signers that must sign.
func (msg MsgClaimSavingsReward) GetSigners() []sdk.AccAddress {
sender, err := sdk.AccAddressFromBech32(msg.Sender)
if err != nil {
panic(err)
}
return []sdk.AccAddress{sender}
}

View File

@ -145,7 +145,8 @@ func TestMsgClaim_Validate(t *testing.T) {
msgClaimHardReward := types.NewMsgClaimHardReward(tc.msgArgs.sender, tc.msgArgs.denomsToClaim)
msgClaimDelegatorReward := types.NewMsgClaimDelegatorReward(tc.msgArgs.sender, tc.msgArgs.denomsToClaim)
msgClaimSwapReward := types.NewMsgClaimSwapReward(tc.msgArgs.sender, tc.msgArgs.denomsToClaim)
msgs := []sdk.Msg{&msgClaimHardReward, &msgClaimDelegatorReward, &msgClaimSwapReward}
msgClaimSavingsReward := types.NewMsgClaimSavingsReward(tc.msgArgs.sender, tc.msgArgs.denomsToClaim)
msgs := []sdk.Msg{&msgClaimHardReward, &msgClaimDelegatorReward, &msgClaimSwapReward, &msgClaimSavingsReward}
for _, msg := range msgs {
t.Run(tc.name, func(t *testing.T) {

View File

@ -372,6 +372,82 @@ func (m *MsgClaimSwapRewardResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgClaimSwapRewardResponse proto.InternalMessageInfo
// MsgClaimSavingsReward message type used to claim savings rewards
type MsgClaimSavingsReward struct {
Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
DenomsToClaim Selections `protobuf:"bytes,2,rep,name=denoms_to_claim,json=denomsToClaim,proto3,castrepeated=Selections" json:"denoms_to_claim"`
}
func (m *MsgClaimSavingsReward) Reset() { *m = MsgClaimSavingsReward{} }
func (m *MsgClaimSavingsReward) String() string { return proto.CompactTextString(m) }
func (*MsgClaimSavingsReward) ProtoMessage() {}
func (*MsgClaimSavingsReward) Descriptor() ([]byte, []int) {
return fileDescriptor_b1cec058e3ff75d5, []int{9}
}
func (m *MsgClaimSavingsReward) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgClaimSavingsReward) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgClaimSavingsReward.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 *MsgClaimSavingsReward) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgClaimSavingsReward.Merge(m, src)
}
func (m *MsgClaimSavingsReward) XXX_Size() int {
return m.Size()
}
func (m *MsgClaimSavingsReward) XXX_DiscardUnknown() {
xxx_messageInfo_MsgClaimSavingsReward.DiscardUnknown(m)
}
var xxx_messageInfo_MsgClaimSavingsReward proto.InternalMessageInfo
// MsgClaimSavingsRewardResponse defines the Msg/ClaimSavingsReward response type.
type MsgClaimSavingsRewardResponse struct {
}
func (m *MsgClaimSavingsRewardResponse) Reset() { *m = MsgClaimSavingsRewardResponse{} }
func (m *MsgClaimSavingsRewardResponse) String() string { return proto.CompactTextString(m) }
func (*MsgClaimSavingsRewardResponse) ProtoMessage() {}
func (*MsgClaimSavingsRewardResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_b1cec058e3ff75d5, []int{10}
}
func (m *MsgClaimSavingsRewardResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgClaimSavingsRewardResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgClaimSavingsRewardResponse.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 *MsgClaimSavingsRewardResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgClaimSavingsRewardResponse.Merge(m, src)
}
func (m *MsgClaimSavingsRewardResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgClaimSavingsRewardResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgClaimSavingsRewardResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgClaimSavingsRewardResponse proto.InternalMessageInfo
func init() {
proto.RegisterType((*Selection)(nil), "kava.incentive.v1beta1.Selection")
proto.RegisterType((*MsgClaimUSDXMintingReward)(nil), "kava.incentive.v1beta1.MsgClaimUSDXMintingReward")
@ -382,41 +458,46 @@ func init() {
proto.RegisterType((*MsgClaimDelegatorRewardResponse)(nil), "kava.incentive.v1beta1.MsgClaimDelegatorRewardResponse")
proto.RegisterType((*MsgClaimSwapReward)(nil), "kava.incentive.v1beta1.MsgClaimSwapReward")
proto.RegisterType((*MsgClaimSwapRewardResponse)(nil), "kava.incentive.v1beta1.MsgClaimSwapRewardResponse")
proto.RegisterType((*MsgClaimSavingsReward)(nil), "kava.incentive.v1beta1.MsgClaimSavingsReward")
proto.RegisterType((*MsgClaimSavingsRewardResponse)(nil), "kava.incentive.v1beta1.MsgClaimSavingsRewardResponse")
}
func init() { proto.RegisterFile("kava/incentive/v1beta1/tx.proto", fileDescriptor_b1cec058e3ff75d5) }
var fileDescriptor_b1cec058e3ff75d5 = []byte{
// 463 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcf, 0x4e, 0x2c, 0x4b,
0xd4, 0xcf, 0xcc, 0x4b, 0x4e, 0xcd, 0x2b, 0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 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27,
0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xed, 0xf4, 0xcc,
0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x90, 0xb9, 0xba, 0x39, 0x89, 0x49, 0xc5,
0x60, 0x96, 0x7e, 0x05, 0x52, 0x41, 0x5c, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x2e, 0x56,
0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xbd, 0xa2, 0xa0, 0x73, 0xa7, 0x05, 0x00, 0x00,
// 504 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x95, 0x31, 0x6f, 0xd3, 0x40,
0x14, 0xc7, 0x7d, 0x2d, 0x54, 0xf4, 0x21, 0x88, 0x74, 0x0a, 0x21, 0x58, 0x60, 0x37, 0x61, 0xa0,
0x02, 0xd5, 0x56, 0x82, 0x10, 0x82, 0xb1, 0x14, 0x89, 0x25, 0x0c, 0x49, 0x91, 0x10, 0x12, 0x8a,
0x2e, 0xc9, 0x71, 0x9c, 0xb0, 0xef, 0x8c, 0xef, 0x9a, 0x16, 0x26, 0x26, 0xc4, 0xc8, 0x82, 0x84,
0x98, 0x3a, 0xf3, 0x49, 0x3a, 0x76, 0x64, 0x02, 0x94, 0x2c, 0xec, 0x7c, 0x01, 0x14, 0x27, 0x76,
0xa2, 0xc4, 0xc6, 0x84, 0x29, 0xdb, 0xdd, 0xbd, 0xff, 0x7b, 0xef, 0xf7, 0x9e, 0xde, 0xd3, 0x81,
0xfd, 0x8a, 0xf4, 0x89, 0xcb, 0x45, 0x97, 0x0a, 0xcd, 0xfb, 0xd4, 0xed, 0xd7, 0x3a, 0x54, 0x93,
0x9a, 0xab, 0x8f,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, 0x50, 0xd5, 0xd9, 0x88, 0xbe, 0xa3, 0xdb, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff,
0x7e, 0x03, 0x15, 0xb3, 0xdf, 0x06, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
@ -439,6 +520,8 @@ type MsgClient interface {
ClaimDelegatorReward(ctx context.Context, in *MsgClaimDelegatorReward, opts ...grpc.CallOption) (*MsgClaimDelegatorRewardResponse, error)
// ClaimSwapReward is a message type used to claim delegator rewards
ClaimSwapReward(ctx context.Context, in *MsgClaimSwapReward, opts ...grpc.CallOption) (*MsgClaimSwapRewardResponse, error)
// ClaimSavingsReward is a message type used to claim savings rewards
ClaimSavingsReward(ctx context.Context, in *MsgClaimSavingsReward, opts ...grpc.CallOption) (*MsgClaimSavingsRewardResponse, error)
}
type msgClient struct {
@ -485,6 +568,15 @@ func (c *msgClient) ClaimSwapReward(ctx context.Context, in *MsgClaimSwapReward,
return out, nil
}
func (c *msgClient) ClaimSavingsReward(ctx context.Context, in *MsgClaimSavingsReward, opts ...grpc.CallOption) (*MsgClaimSavingsRewardResponse, error) {
out := new(MsgClaimSavingsRewardResponse)
err := c.cc.Invoke(ctx, "/kava.incentive.v1beta1.Msg/ClaimSavingsReward", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service.
type MsgServer interface {
// ClaimUSDXMintingReward is a message type used to claim USDX minting rewards
@ -495,6 +587,8 @@ type MsgServer interface {
ClaimDelegatorReward(context.Context, *MsgClaimDelegatorReward) (*MsgClaimDelegatorRewardResponse, error)
// ClaimSwapReward is a message type used to claim delegator rewards
ClaimSwapReward(context.Context, *MsgClaimSwapReward) (*MsgClaimSwapRewardResponse, error)
// ClaimSavingsReward is a message type used to claim savings rewards
ClaimSavingsReward(context.Context, *MsgClaimSavingsReward) (*MsgClaimSavingsRewardResponse, error)
}
// UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -513,6 +607,9 @@ func (*UnimplementedMsgServer) ClaimDelegatorReward(ctx context.Context, req *Ms
func (*UnimplementedMsgServer) ClaimSwapReward(ctx context.Context, req *MsgClaimSwapReward) (*MsgClaimSwapRewardResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ClaimSwapReward not implemented")
}
func (*UnimplementedMsgServer) ClaimSavingsReward(ctx context.Context, req *MsgClaimSavingsReward) (*MsgClaimSavingsRewardResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ClaimSavingsReward not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv)
@ -590,6 +687,24 @@ func _Msg_ClaimSwapReward_Handler(srv interface{}, ctx context.Context, dec func
return interceptor(ctx, in, info, handler)
}
func _Msg_ClaimSavingsReward_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgClaimSavingsReward)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).ClaimSavingsReward(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/kava.incentive.v1beta1.Msg/ClaimSavingsReward",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).ClaimSavingsReward(ctx, req.(*MsgClaimSavingsReward))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "kava.incentive.v1beta1.Msg",
HandlerType: (*MsgServer)(nil),
@ -610,6 +725,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "ClaimSwapReward",
Handler: _Msg_ClaimSwapReward_Handler,
},
{
MethodName: "ClaimSavingsReward",
Handler: _Msg_ClaimSavingsReward_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "kava/incentive/v1beta1/tx.proto",
@ -913,6 +1032,73 @@ func (m *MsgClaimSwapRewardResponse) MarshalToSizedBuffer(dAtA []byte) (int, err
return len(dAtA) - i, nil
}
func (m *MsgClaimSavingsReward) 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 *MsgClaimSavingsReward) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgClaimSavingsReward) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.DenomsToClaim) > 0 {
for iNdEx := len(m.DenomsToClaim) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.DenomsToClaim[iNdEx].MarshalToSizedBuffer(dAtA[:i])
if err != nil {
return 0, err
}
i -= size
i = encodeVarintTx(dAtA, i, uint64(size))
}
i--
dAtA[i] = 0x12
}
}
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] = 0xa
}
return len(dAtA) - i, nil
}
func (m *MsgClaimSavingsRewardResponse) 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 *MsgClaimSavingsRewardResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgClaimSavingsRewardResponse) 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
@ -1051,6 +1237,34 @@ func (m *MsgClaimSwapRewardResponse) Size() (n int) {
return n
}
func (m *MsgClaimSavingsReward) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.Sender)
if l > 0 {
n += 1 + l + sovTx(uint64(l))
}
if len(m.DenomsToClaim) > 0 {
for _, e := range m.DenomsToClaim {
l = e.Size()
n += 1 + l + sovTx(uint64(l))
}
}
return n
}
func (m *MsgClaimSavingsRewardResponse) 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
}
@ -1833,6 +2047,172 @@ func (m *MsgClaimSwapRewardResponse) Unmarshal(dAtA []byte) error {
}
return nil
}
func (m *MsgClaimSavingsReward) 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: MsgClaimSavingsReward: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgClaimSavingsReward: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
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
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DenomsToClaim", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowTx
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= int(b&0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthTx
}
postIndex := iNdEx + msglen
if postIndex < 0 {
return ErrInvalidLengthTx
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DenomsToClaim = append(m.DenomsToClaim, Selection{})
if err := m.DenomsToClaim[len(m.DenomsToClaim)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
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 *MsgClaimSavingsRewardResponse) 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: MsgClaimSavingsRewardResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgClaimSavingsRewardResponse: 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