diff --git a/proto/sge/reward/reward.proto b/proto/sge/reward/reward.proto index 9f87b21e..a19d92e9 100644 --- a/proto/sge/reward/reward.proto +++ b/proto/sge/reward/reward.proto @@ -23,12 +23,12 @@ message RewardCommon { // Definition is the type for reward declaration for a campaign. message Definition { ReceiverType rec_type = 1; - string amount = 2 [ + ReceiverAccType rec_acc_type = 2; + string amount = 3 [ (gogoproto.customtype) = "cosmossdk.io/math.Int", (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"amount\"" ]; - ReceiverAccType receiver_acc_type = 3; uint64 unlock_ts = 4 [ (gogoproto.customname) = "UnlockTS", (gogoproto.jsontag) = "unlock_ts", @@ -49,7 +49,7 @@ message Allocation { (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"amount\"" ]; - ReceiverAccType receiver_acc_type = 2; + ReceiverAccType rec_acc_type = 2; uint64 unlock_ts = 3 [ (gogoproto.customname) = "UnlockTS", (gogoproto.jsontag) = "unlock_ts", diff --git a/x/reward/client/cli/query_campaign_test.go b/x/reward/client/cli/query_campaign_test.go index 4e2eb0ea..926b820d 100644 --- a/x/reward/client/cli/query_campaign_test.go +++ b/x/reward/client/cli/query_campaign_test.go @@ -42,9 +42,9 @@ func networkWithCampaignObjects(t *testing.T, n int) (*network.Network, []types. EndTS: uint64(time.Now().Add(5 * time.Minute).Unix()), RewardType: types.RewardType_REWARD_TYPE_AFFILIATION, RewardDefs: []types.Definition{{ - RecType: types.ReceiverType_RECEIVER_TYPE_REFEREE, - Amount: sdkmath.NewInt(100), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, + RecType: types.ReceiverType_RECEIVER_TYPE_REFEREE, + Amount: sdkmath.NewInt(100), + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, }}, Pool: types.Pool{Spent: sdkmath.NewInt(100), Total: sdkmath.NewInt(1000)}, } diff --git a/x/reward/keeper/campaign_test.go b/x/reward/keeper/campaign_test.go index c5cbec5e..b007858a 100644 --- a/x/reward/keeper/campaign_test.go +++ b/x/reward/keeper/campaign_test.go @@ -30,9 +30,9 @@ func createNCampaign(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Camp items[i].EndTS = uint64(time.Now().Add(5 * time.Minute).Unix()) items[i].RewardType = types.RewardType_REWARD_TYPE_REFERRAL items[i].RewardDefs = []types.Definition{{ - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - Amount: sdkmath.NewInt(100), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, + Amount: sdkmath.NewInt(100), }} items[i].Pool = types.Pool{Spent: sdk.ZeroInt(), Total: sdkmath.NewInt(100)} diff --git a/x/reward/keeper/distribution.go b/x/reward/keeper/distribution.go index 714e9835..3fd9bf0b 100644 --- a/x/reward/keeper/distribution.go +++ b/x/reward/keeper/distribution.go @@ -11,7 +11,7 @@ import ( // DistributeRewards distributes the rewards according to the input distribution list. func (k Keeper) DistributeRewards(ctx sdk.Context, funderAddr string, distributions []types.Distribution) error { for _, d := range distributions { - switch d.Allocation.ReceiverAccType { + switch d.Allocation.RecAccType { case types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN: return k.modFunder.Refund( types.RewardPoolFunder{}, ctx, diff --git a/x/reward/keeper/msg_server_campaign_test.go b/x/reward/keeper/msg_server_campaign_test.go index bac148c8..402eaa23 100644 --- a/x/reward/keeper/msg_server_campaign_test.go +++ b/x/reward/keeper/msg_server_campaign_test.go @@ -38,10 +38,10 @@ func TestCampaignMsgServerCreate(t *testing.T) { "type": types.RewardType_REWARD_TYPE_SIGNUP, "reward_defs": []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - Amount: sdkmath.NewInt(100), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, - UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, + Amount: sdkmath.NewInt(100), + UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), }, }, "pool_amount": sdkmath.NewInt(1000000), @@ -111,10 +111,10 @@ func TestCampaignMsgServerUpdate(t *testing.T) { "type": types.RewardType_REWARD_TYPE_SIGNUP, "reward_defs": []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - Amount: sdkmath.NewInt(100), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, - UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, + Amount: sdkmath.NewInt(100), + UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), }, }, "pool_amount": sdkmath.NewInt(10000), diff --git a/x/reward/keeper/msg_server_reward_test.go b/x/reward/keeper/msg_server_reward_test.go index 52aaaf7f..c6eb1fed 100644 --- a/x/reward/keeper/msg_server_reward_test.go +++ b/x/reward/keeper/msg_server_reward_test.go @@ -72,10 +72,10 @@ func TestMsgApplySignupReward(t *testing.T) { campClaims["type"] = types.RewardType_REWARD_TYPE_SIGNUP campClaims["reward_defs"] = []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - Amount: sdkmath.NewInt(100), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, - UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, + Amount: sdkmath.NewInt(100), + UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), }, } @@ -150,10 +150,10 @@ func TestMsgApplyAffiliationReward(t *testing.T) { campClaims["type"] = types.RewardType_REWARD_TYPE_AFFILIATION campClaims["reward_defs"] = []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - Amount: sdkmath.NewInt(100), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, - UnlockTS: 0, + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, + Amount: sdkmath.NewInt(100), + UnlockTS: 0, }, } @@ -245,16 +245,16 @@ func TestMsgApplyReferralReward(t *testing.T) { campClaims["type"] = types.RewardType_REWARD_TYPE_REFERRAL campClaims["reward_defs"] = []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_REFEREE, - Amount: sdkmath.NewInt(100), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, - UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), + RecType: types.ReceiverType_RECEIVER_TYPE_REFEREE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, + Amount: sdkmath.NewInt(100), + UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), }, { - RecType: types.ReceiverType_RECEIVER_TYPE_REFERRER, - Amount: sdkmath.NewInt(150), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, - UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), + RecType: types.ReceiverType_RECEIVER_TYPE_REFERRER, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, + Amount: sdkmath.NewInt(150), + UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), }, } @@ -341,10 +341,10 @@ func TestMsgApplyNoLossBetsReward(t *testing.T) { campClaims["type"] = types.RewardType_REWARD_TYPE_NOLOSS_BETS campClaims["reward_defs"] = []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - Amount: sdkmath.NewInt(100), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, - UnlockTS: 0, + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, + Amount: sdkmath.NewInt(100), + UnlockTS: 0, }, } @@ -433,10 +433,10 @@ func TestMsgApplySignupRewardSubAcc(t *testing.T) { campClaims["type"] = types.RewardType_REWARD_TYPE_SIGNUP campClaims["reward_defs"] = []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - Amount: sdkmath.NewInt(100), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, - UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, + Amount: sdkmath.NewInt(100), + UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), }, } @@ -533,10 +533,10 @@ func TestMsgApplySubAccFunds(t *testing.T) { campClaims["type"] = types.RewardType_REWARD_TYPE_SIGNUP campClaims["reward_defs"] = []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - Amount: sdkmath.NewInt(rewardAmount), - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, - UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_SUB, + Amount: sdkmath.NewInt(rewardAmount), + UnlockTS: uint64(ctx.BlockTime().Add(10 * time.Minute).Unix()), }, } diff --git a/x/reward/types/reward.go b/x/reward/types/reward.go index 7ba39f0e..68410df2 100644 --- a/x/reward/types/reward.go +++ b/x/reward/types/reward.go @@ -34,15 +34,15 @@ func NewDistribution(accAddr string, allocation Allocation) Distribution { // NewAllocation created allocation object. func NewAllocation(amount sdkmath.Int, receiverAccType ReceiverAccType, unlockTS uint64) Allocation { return Allocation{ - Amount: amount, - ReceiverAccType: receiverAccType, - UnlockTS: unlockTS, + Amount: amount, + RecAccType: receiverAccType, + UnlockTS: unlockTS, } } // ValidateBasic validates the basic properties of a reward definition. func (d *Definition) ValidateBasic(blockTime uint64) error { - if d.ReceiverAccType != ReceiverAccType_RECEIVER_ACC_TYPE_SUB { + if d.RecAccType != ReceiverAccType_RECEIVER_ACC_TYPE_SUB { if d.UnlockTS != 0 { return sdkerrors.Wrapf(ErrUnlockTSIsSubAccOnly, "%d", d.UnlockTS) } diff --git a/x/reward/types/reward.pb.go b/x/reward/types/reward.pb.go index fc51240b..a44d1ed4 100644 --- a/x/reward/types/reward.pb.go +++ b/x/reward/types/reward.pb.go @@ -196,10 +196,10 @@ func (m *RewardCommon) GetTS() uint64 { // Definition is the type for reward declaration for a campaign. type Definition struct { - RecType ReceiverType `protobuf:"varint,1,opt,name=rec_type,json=recType,proto3,enum=sgenetwork.sge.reward.ReceiverType" json:"rec_type,omitempty"` - Amount cosmossdk_io_math.Int `protobuf:"bytes,2,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount" yaml:"amount"` - ReceiverAccType ReceiverAccType `protobuf:"varint,3,opt,name=receiver_acc_type,json=receiverAccType,proto3,enum=sgenetwork.sge.reward.ReceiverAccType" json:"receiver_acc_type,omitempty"` - UnlockTS uint64 `protobuf:"varint,4,opt,name=unlock_ts,proto3" json:"unlock_ts"` + RecType ReceiverType `protobuf:"varint,1,opt,name=rec_type,json=recType,proto3,enum=sgenetwork.sge.reward.ReceiverType" json:"rec_type,omitempty"` + RecAccType ReceiverAccType `protobuf:"varint,2,opt,name=rec_acc_type,json=recAccType,proto3,enum=sgenetwork.sge.reward.ReceiverAccType" json:"rec_acc_type,omitempty"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,3,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount" yaml:"amount"` + UnlockTS uint64 `protobuf:"varint,4,opt,name=unlock_ts,proto3" json:"unlock_ts"` } func (m *Definition) Reset() { *m = Definition{} } @@ -242,9 +242,9 @@ func (m *Definition) GetRecType() ReceiverType { return ReceiverType_RECEIVER_TYPE_UNSPECIFIED } -func (m *Definition) GetReceiverAccType() ReceiverAccType { +func (m *Definition) GetRecAccType() ReceiverAccType { if m != nil { - return m.ReceiverAccType + return m.RecAccType } return ReceiverAccType_RECEIVER_ACC_TYPE_UNSPECIFIED } @@ -311,9 +311,9 @@ func (m *Distribution) GetAllocation() Allocation { // Allocation is the distribution allocation of the rewards. type Allocation struct { - Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount" yaml:"amount"` - ReceiverAccType ReceiverAccType `protobuf:"varint,2,opt,name=receiver_acc_type,json=receiverAccType,proto3,enum=sgenetwork.sge.reward.ReceiverAccType" json:"receiver_acc_type,omitempty"` - UnlockTS uint64 `protobuf:"varint,3,opt,name=unlock_ts,proto3" json:"unlock_ts"` + Amount cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=amount,proto3,customtype=cosmossdk.io/math.Int" json:"amount" yaml:"amount"` + RecAccType ReceiverAccType `protobuf:"varint,2,opt,name=rec_acc_type,json=recAccType,proto3,enum=sgenetwork.sge.reward.ReceiverAccType" json:"rec_acc_type,omitempty"` + UnlockTS uint64 `protobuf:"varint,3,opt,name=unlock_ts,proto3" json:"unlock_ts"` } func (m *Allocation) Reset() { *m = Allocation{} } @@ -349,9 +349,9 @@ func (m *Allocation) XXX_DiscardUnknown() { var xxx_messageInfo_Allocation proto.InternalMessageInfo -func (m *Allocation) GetReceiverAccType() ReceiverAccType { +func (m *Allocation) GetRecAccType() ReceiverAccType { if m != nil { - return m.ReceiverAccType + return m.RecAccType } return ReceiverAccType_RECEIVER_ACC_TYPE_UNSPECIFIED } @@ -430,50 +430,50 @@ func init() { func init() { proto.RegisterFile("sge/reward/reward.proto", fileDescriptor_3412add70a4f177f) } var fileDescriptor_3412add70a4f177f = []byte{ - // 674 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0x8e, 0x9d, 0xa8, 0x4d, 0x4f, 0x73, 0x6f, 0x7d, 0x47, 0xfd, 0x49, 0x7a, 0x6f, 0xe3, 0x36, - 0x57, 0x42, 0xa5, 0x12, 0x8e, 0x54, 0x16, 0x48, 0x2c, 0x90, 0x1c, 0xc7, 0xa9, 0x2c, 0x85, 0xb4, - 0x1a, 0x27, 0x20, 0x58, 0x60, 0xb9, 0xce, 0xe0, 0x5a, 0x89, 0x3d, 0x91, 0x3d, 0xa1, 0x74, 0xc3, - 0x0b, 0xb0, 0x61, 0xc3, 0x03, 0xf0, 0x36, 0x5d, 0x76, 0x89, 0x58, 0x58, 0x90, 0xee, 0xba, 0xe4, - 0x09, 0x90, 0x27, 0x6e, 0x93, 0xb4, 0x45, 0x08, 0xd1, 0x95, 0xcf, 0x9c, 0xef, 0x9b, 0x39, 0xdf, - 0x7c, 0x73, 0x7c, 0x60, 0x2d, 0x72, 0x49, 0x35, 0x24, 0xc7, 0x76, 0xd8, 0x4d, 0x3f, 0xca, 0x20, - 0xa4, 0x8c, 0xa2, 0x95, 0xc8, 0x25, 0x01, 0x61, 0xc7, 0x34, 0xec, 0x29, 0x91, 0x4b, 0x94, 0x31, - 0xb8, 0xbe, 0xec, 0x52, 0x97, 0x72, 0x46, 0x35, 0x89, 0xc6, 0xe4, 0xca, 0x7b, 0x01, 0x0a, 0x98, - 0x13, 0x34, 0xea, 0xfb, 0x34, 0x40, 0x45, 0x98, 0x77, 0x42, 0x62, 0x33, 0x1a, 0x16, 0x85, 0x4d, - 0x61, 0x7b, 0x01, 0x5f, 0x2e, 0x91, 0x06, 0x05, 0xc7, 0xf6, 0x07, 0xb6, 0xe7, 0x06, 0x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0x81, 0x75, 0x4d, 0x37, 0x9e, 0xe9, 0xd8, - 0x52, 0x35, 0xed, 0x36, 0x85, 0xeb, 0xb0, 0x7a, 0x93, 0xf2, 0x54, 0x35, 0x5a, 0x92, 0x80, 0x4a, - 0xb0, 0x72, 0x13, 0x33, 0x3b, 0x35, 0x49, 0xdc, 0x79, 0x97, 0x4c, 0x9b, 0x89, 0x63, 0x68, 0x03, - 0x4a, 0x57, 0xd4, 0x5b, 0xaa, 0xf0, 0xfb, 0x4e, 0xc3, 0xa6, 0xd1, 0xda, 0x6b, 0xea, 0x92, 0x30, - 0x53, 0x7f, 0xca, 0x0b, 0x1d, 0x4b, 0xe2, 0x4c, 0xfd, 0x09, 0xa6, 0xeb, 0x52, 0xb6, 0xa6, 0x9d, - 0x8e, 0xca, 0xc2, 0xd9, 0xa8, 0x2c, 0x7c, 0x1d, 0x95, 0x85, 0x0f, 0xe7, 0xe5, 0xcc, 0xd9, 0x79, - 0x39, 0xf3, 0xf9, 0xbc, 0x9c, 0x79, 0x79, 0xdf, 0xf5, 0xd8, 0xd1, 0xf0, 0x50, 0x71, 0xa8, 0x5f, - 0x8d, 0x5c, 0xf2, 0x20, 0x7d, 0xeb, 0x24, 0xae, 0xbe, 0xbd, 0x9c, 0xb3, 0x49, 0x43, 0x44, 0x87, - 0x73, 0x7c, 0x74, 0x3e, 0xfc, 0x11, 0x00, 0x00, 0xff, 0xff, 0x93, 0x8b, 0xe0, 0x6a, 0x82, 0x05, - 0x00, 0x00, + // 675 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4d, 0x6f, 0xd3, 0x4a, + 0x14, 0x8d, 0x9d, 0xa8, 0x4d, 0x6f, 0xf3, 0xde, 0xb3, 0x46, 0xfd, 0x48, 0xfa, 0x68, 0xdc, 0x06, + 0x09, 0x95, 0x4a, 0x38, 0x52, 0x59, 0x20, 0xb1, 0x40, 0x72, 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 0xb7, 0x6e, 0x2a, 0xd2, + 0xcc, 0xfe, 0x53, 0x5e, 0x98, 0x58, 0x91, 0x67, 0xf6, 0x9f, 0x60, 0xa6, 0xa9, 0xa4, 0x2b, 0xc6, + 0xc9, 0xb0, 0x28, 0x9d, 0x0e, 0x8b, 0xd2, 0xf7, 0x61, 0x51, 0xfa, 0x78, 0x56, 0x4c, 0x9d, 0x9e, + 0x15, 0x53, 0x5f, 0xcf, 0x8a, 0xa9, 0x57, 0xf7, 0x5d, 0x8f, 0x1f, 0x0e, 0x0e, 0x34, 0xc2, 0xfc, + 0x72, 0xe4, 0xd2, 0x07, 0xe3, 0x5e, 0x27, 0x71, 0xf9, 0xdd, 0xc5, 0x4c, 0x4d, 0x2e, 0x44, 0x74, + 0x30, 0x27, 0xc6, 0xe4, 0xc3, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x7a, 0xe8, 0x36, 0x6e, + 0x05, 0x00, 0x00, } func (m *RewardCommon) Marshal() (dAtA []byte, err error) { @@ -543,11 +543,6 @@ func (m *Definition) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x20 } - if m.ReceiverAccType != 0 { - i = encodeVarintReward(dAtA, i, uint64(m.ReceiverAccType)) - i-- - dAtA[i] = 0x18 - } { size := m.Amount.Size() i -= size @@ -557,7 +552,12 @@ func (m *Definition) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintReward(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0x1a + if m.RecAccType != 0 { + i = encodeVarintReward(dAtA, i, uint64(m.RecAccType)) + i-- + dAtA[i] = 0x10 + } if m.RecType != 0 { i = encodeVarintReward(dAtA, i, uint64(m.RecType)) i-- @@ -631,8 +631,8 @@ func (m *Allocation) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - if m.ReceiverAccType != 0 { - i = encodeVarintReward(dAtA, i, uint64(m.ReceiverAccType)) + if m.RecAccType != 0 { + i = encodeVarintReward(dAtA, i, uint64(m.RecAccType)) i-- dAtA[i] = 0x10 } @@ -724,11 +724,11 @@ func (m *Definition) Size() (n int) { if m.RecType != 0 { n += 1 + sovReward(uint64(m.RecType)) } + if m.RecAccType != 0 { + n += 1 + sovReward(uint64(m.RecAccType)) + } l = m.Amount.Size() n += 1 + l + sovReward(uint64(l)) - if m.ReceiverAccType != 0 { - n += 1 + sovReward(uint64(m.ReceiverAccType)) - } if m.UnlockTS != 0 { n += 1 + sovReward(uint64(m.UnlockTS)) } @@ -758,8 +758,8 @@ func (m *Allocation) Size() (n int) { _ = l l = m.Amount.Size() n += 1 + l + sovReward(uint64(l)) - if m.ReceiverAccType != 0 { - n += 1 + sovReward(uint64(m.ReceiverAccType)) + if m.RecAccType != 0 { + n += 1 + sovReward(uint64(m.RecAccType)) } if m.UnlockTS != 0 { n += 1 + sovReward(uint64(m.UnlockTS)) @@ -971,6 +971,25 @@ func (m *Definition) Unmarshal(dAtA []byte) error { } } case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RecAccType", wireType) + } + m.RecAccType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowReward + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RecAccType |= ReceiverAccType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) } @@ -1004,25 +1023,6 @@ func (m *Definition) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReceiverAccType", wireType) - } - m.ReceiverAccType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowReward - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ReceiverAccType |= ReceiverAccType(b&0x7F) << shift - if b < 0x80 { - break - } - } case 4: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field UnlockTS", wireType) @@ -1243,9 +1243,9 @@ func (m *Allocation) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReceiverAccType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RecAccType", wireType) } - m.ReceiverAccType = 0 + m.RecAccType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowReward @@ -1255,7 +1255,7 @@ func (m *Allocation) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ReceiverAccType |= ReceiverAccType(b&0x7F) << shift + m.RecAccType |= ReceiverAccType(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/reward/types/reward_affiliate.go b/x/reward/types/reward_affiliate.go index 2b720f7a..904dfc3b 100644 --- a/x/reward/types/reward_affiliate.go +++ b/x/reward/types/reward_affiliate.go @@ -21,7 +21,7 @@ func (afr AffiliationReward) VaidateDefinitions(campaign Campaign) error { if campaign.RewardDefs[0].RecType != ReceiverType_RECEIVER_TYPE_SINGLE { return sdkerrors.Wrapf(ErrInvalidReceiverType, "affiliation rewards can be defined for subaccount only") } - if campaign.RewardDefs[0].ReceiverAccType == ReceiverAccType_RECEIVER_ACC_TYPE_UNSPECIFIED { + if campaign.RewardDefs[0].RecAccType == ReceiverAccType_RECEIVER_ACC_TYPE_UNSPECIFIED { return sdkerrors.Wrapf(ErrInvalidReceiverType, "bad account type for the receiver") } return nil @@ -47,7 +47,7 @@ func (afr AffiliationReward) CalculateDistributions(goCtx context.Context, ctx s payload.Receiver.Addr, NewAllocation( definition.Amount, - definition.ReceiverAccType, + definition.RecAccType, definition.UnlockTS, ), ), diff --git a/x/reward/types/reward_noloss.go b/x/reward/types/reward_noloss.go index 644b6e09..b42f2592 100644 --- a/x/reward/types/reward_noloss.go +++ b/x/reward/types/reward_noloss.go @@ -23,7 +23,7 @@ func (afr NoLossBetsReward) VaidateDefinitions(campaign Campaign) error { if campaign.RewardDefs[0].RecType != ReceiverType_RECEIVER_TYPE_SINGLE { return sdkerrors.Wrapf(ErrInvalidReceiverType, "noloss bets rewards can be defined for subaccount only") } - if campaign.RewardDefs[0].ReceiverAccType == ReceiverAccType_RECEIVER_ACC_TYPE_UNSPECIFIED { + if campaign.RewardDefs[0].RecAccType == ReceiverAccType_RECEIVER_ACC_TYPE_UNSPECIFIED { return sdkerrors.Wrapf(ErrInvalidReceiverType, "bad account type for the receiver") } return nil @@ -64,7 +64,7 @@ func (afr NoLossBetsReward) CalculateDistributions(goCtx context.Context, ctx sd payload.Receiver.Addr, NewAllocation( definition.Amount, - definition.ReceiverAccType, + definition.RecAccType, definition.UnlockTS, ), ), diff --git a/x/reward/types/reward_referral.go b/x/reward/types/reward_referral.go index e236a0d2..18f47eb6 100644 --- a/x/reward/types/reward_referral.go +++ b/x/reward/types/reward_referral.go @@ -18,7 +18,7 @@ func (rfr ReferralReward) VaidateDefinitions(campaign Campaign) error { hasReferrer := false hasReferee := false for _, d := range campaign.RewardDefs { - if d.ReceiverAccType != ReceiverAccType_RECEIVER_ACC_TYPE_SUB { + if d.RecAccType != ReceiverAccType_RECEIVER_ACC_TYPE_SUB { return sdkerrors.Wrapf(ErrInvalidReceiverType, "referral rewards can be defined for subaccount only") } switch d.RecType { @@ -56,7 +56,7 @@ func (rfr ReferralReward) CalculateDistributions(goCtx context.Context, ctx sdk. r.Addr, NewAllocation( d.Amount, - d.ReceiverAccType, + d.RecAccType, d.UnlockTS, ), )) diff --git a/x/reward/types/reward_signup.go b/x/reward/types/reward_signup.go index 2c54658c..b6589412 100644 --- a/x/reward/types/reward_signup.go +++ b/x/reward/types/reward_signup.go @@ -21,7 +21,7 @@ func (sur SignUpReward) VaidateDefinitions(campaign Campaign) error { if campaign.RewardDefs[0].RecType != ReceiverType_RECEIVER_TYPE_SINGLE { return sdkerrors.Wrapf(ErrInvalidReceiverType, "signup rewards can be defined for single receiver only") } - if campaign.RewardDefs[0].ReceiverAccType != ReceiverAccType_RECEIVER_ACC_TYPE_SUB { + if campaign.RewardDefs[0].RecAccType != ReceiverAccType_RECEIVER_ACC_TYPE_SUB { return sdkerrors.Wrapf(ErrInvalidReceiverType, "signup rewards can be defined for subaccount only") } return nil @@ -47,7 +47,7 @@ func (sur SignUpReward) CalculateDistributions(goCtx context.Context, ctx sdk.Co payload.Receiver.Addr, NewAllocation( definition.Amount, - definition.ReceiverAccType, + definition.RecAccType, definition.UnlockTS, ), ), diff --git a/x/reward/types/ticket_test.go b/x/reward/types/ticket_test.go index 03007638..deecdb38 100644 --- a/x/reward/types/ticket_test.go +++ b/x/reward/types/ticket_test.go @@ -57,10 +57,10 @@ func TestCreateCampaignPayloadValidation(t *testing.T) { EndTs: blockTime + 2, RewardDefs: []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, - Amount: sdkmath.NewInt(1000), - UnlockTS: 0, + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, + Amount: sdkmath.NewInt(1000), + UnlockTS: 0, }, }, }, @@ -74,10 +74,10 @@ func TestCreateCampaignPayloadValidation(t *testing.T) { EndTs: blockTime + 2, RewardDefs: []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, - Amount: sdkmath.NewInt(1000), - UnlockTS: 0, + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, + Amount: sdkmath.NewInt(1000), + UnlockTS: 0, }, }, PoolAmount: sdkmath.NewInt(0), @@ -93,10 +93,10 @@ func TestCreateCampaignPayloadValidation(t *testing.T) { Type: types.RewardType_REWARD_TYPE_SIGNUP, RewardDefs: []types.Definition{ { - RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, - ReceiverAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, - Amount: sdkmath.NewInt(1000), - UnlockTS: 0, + RecType: types.ReceiverType_RECEIVER_TYPE_SINGLE, + RecAccType: types.ReceiverAccType_RECEIVER_ACC_TYPE_MAIN, + Amount: sdkmath.NewInt(1000), + UnlockTS: 0, }, }, PoolAmount: poolBalance,