From b59163a1b0f565e9516c28de7f8b9ee1df7475e3 Mon Sep 17 00:00:00 2001 From: scorpioborn <97235353+scorpioborn@users.noreply.github.com> Date: Wed, 15 Nov 2023 12:46:51 +0300 Subject: [PATCH] feat: genesis rewards list and validations --- proto/sge/reward/genesis.proto | 4 + x/reward/genesis.go | 12 ++ x/reward/genesis_test.go | 24 ++++ x/reward/keeper/reward.go | 36 +++++- x/reward/types/genesis.go | 27 ++++ x/reward/types/genesis.pb.go | 230 ++++++++++++++++++++++++++++++--- x/reward/types/genesis_test.go | 72 ++++++++++- 7 files changed, 381 insertions(+), 24 deletions(-) diff --git a/proto/sge/reward/genesis.proto b/proto/sge/reward/genesis.proto index 173d4ee4..562b052d 100644 --- a/proto/sge/reward/genesis.proto +++ b/proto/sge/reward/genesis.proto @@ -5,6 +5,7 @@ package sgenetwork.sge.reward; import "gogoproto/gogo.proto"; import "sge/reward/params.proto"; import "sge/reward/campaign.proto"; +import "sge/reward/reward.proto"; option go_package = "github.com/sge-network/sge/x/reward/types"; @@ -12,5 +13,8 @@ option go_package = "github.com/sge-network/sge/x/reward/types"; message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; repeated Campaign campaign_list = 2 [ (gogoproto.nullable) = false ]; + repeated Reward reward_list = 3 [ (gogoproto.nullable) = false ]; + repeated RewardByCategory reward_by_rec_cat_list = 4 [ (gogoproto.nullable) = false ]; + repeated RewardByCampaign reward_by_campaign_list = 5 [ (gogoproto.nullable) = false ]; // Fixme: It would need another param for all the distributed rewards } diff --git a/x/reward/genesis.go b/x/reward/genesis.go index c89a638f..206f1a6a 100644 --- a/x/reward/genesis.go +++ b/x/reward/genesis.go @@ -13,6 +13,15 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, elem := range genState.CampaignList { k.SetCampaign(ctx, elem) } + for _, elem := range genState.RewardList { + k.SetReward(ctx, elem) + } + for _, elem := range genState.RewardByRecCatList { + k.SetRewardByReceiver(ctx, elem) + } + for _, elem := range genState.RewardByCampaignList { + k.SetRewardByCampaign(ctx, elem) + } k.SetParams(ctx, genState.Params) } @@ -22,6 +31,9 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.Params = k.GetParams(ctx) genesis.CampaignList = k.GetAllCampaign(ctx) + genesis.RewardList = k.GetAllRewards(ctx) + genesis.RewardByRecCatList = k.GetAllRewardsByReceiverAndCategory(ctx) + genesis.RewardByCampaignList = k.GetAllRewardsByCampaign(ctx) return genesis } diff --git a/x/reward/genesis_test.go b/x/reward/genesis_test.go index f5475ea2..c76787c4 100644 --- a/x/reward/genesis_test.go +++ b/x/reward/genesis_test.go @@ -24,6 +24,30 @@ func TestGenesis(t *testing.T) { UID: uuid.NewString(), }, }, + RewardList: []types.Reward{ + { + UID: uuid.NewString(), + }, + { + UID: uuid.NewString(), + }, + }, + RewardByRecCatList: []types.RewardByCategory{ + { + UID: uuid.NewString(), + }, + { + UID: uuid.NewString(), + }, + }, + RewardByCampaignList: []types.RewardByCampaign{ + { + UID: uuid.NewString(), + }, + { + UID: uuid.NewString(), + }, + }, } tApp, ctx, err := simapp.GetTestObjects() diff --git a/x/reward/keeper/reward.go b/x/reward/keeper/reward.go index 86b9e3f6..9c2a721b 100644 --- a/x/reward/keeper/reward.go +++ b/x/reward/keeper/reward.go @@ -37,8 +37,8 @@ func (k Keeper) RemoveReward( store.Delete(types.GetRewardKey(uid)) } -// GetAllReward returns all reward -func (k Keeper) GetAllReward(ctx sdk.Context) (list []types.Reward) { +// GetAllRewards returns all reward +func (k Keeper) GetAllRewards(ctx sdk.Context) (list []types.Reward) { store := k.getRewardStore(ctx) iterator := sdk.KVStorePrefixIterator(store, []byte{}) @@ -81,8 +81,40 @@ func (k Keeper) GetRewardsByAddressAndCategory( return } +// GetAllRewardsByReceiverAndCategory returns all rewards by receiver and category +func (k Keeper) GetAllRewardsByReceiverAndCategory(ctx sdk.Context) (list []types.RewardByCategory) { + store := k.getRewardByReceiverAndCategoryStore(ctx) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.RewardByCategory + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} + func (k Keeper) SetRewardByCampaign(ctx sdk.Context, rewByCampaign types.RewardByCampaign) { store := k.getRewardsByCampaignStore(ctx) b := k.cdc.MustMarshal(&rewByCampaign) store.Set(types.GetRewardsByCampaignKey(rewByCampaign.CampaignUID, rewByCampaign.UID), b) } + +// GetAllRewardsByCampaign returns all rewards by campaign +func (k Keeper) GetAllRewardsByCampaign(ctx sdk.Context) (list []types.RewardByCampaign) { + store := k.getRewardsByCampaignStore(ctx) + iterator := sdk.KVStorePrefixIterator(store, []byte{}) + + defer iterator.Close() + + for ; iterator.Valid(); iterator.Next() { + var val types.RewardByCampaign + k.cdc.MustUnmarshal(iterator.Value(), &val) + list = append(list, val) + } + + return +} diff --git a/x/reward/types/genesis.go b/x/reward/types/genesis.go index 38b3932d..fffc987d 100644 --- a/x/reward/types/genesis.go +++ b/x/reward/types/genesis.go @@ -29,5 +29,32 @@ func (gs GenesisState) Validate() error { campaignIndexMap[index] = struct{}{} } + rewardIndexMap := make(map[string]struct{}) + for _, elem := range gs.RewardList { + index := string(GetRewardKey(elem.UID)) + if _, ok := rewardIndexMap[index]; ok { + return fmt.Errorf("duplicated index for reward") + } + rewardIndexMap[index] = struct{}{} + } + + rewardByRecCatIndexMap := make(map[string]struct{}) + for _, elem := range gs.RewardByRecCatList { + index := string(GetRewardKey(elem.UID)) + if _, ok := rewardByRecCatIndexMap[index]; ok { + return fmt.Errorf("duplicated index for reward by receiver and category") + } + rewardByRecCatIndexMap[index] = struct{}{} + } + + rewardByCampaignIndexMap := make(map[string]struct{}) + for _, elem := range gs.RewardByCampaignList { + index := string(GetRewardKey(elem.UID)) + if _, ok := rewardByCampaignIndexMap[index]; ok { + return fmt.Errorf("duplicated index for reward by campaign") + } + rewardByCampaignIndexMap[index] = struct{}{} + } + return gs.Params.Validate() } diff --git a/x/reward/types/genesis.pb.go b/x/reward/types/genesis.pb.go index 511f4112..3b2f4761 100644 --- a/x/reward/types/genesis.pb.go +++ b/x/reward/types/genesis.pb.go @@ -25,8 +25,11 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the reward module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - CampaignList []Campaign `protobuf:"bytes,2,rep,name=campaign_list,json=campaignList,proto3" json:"campaign_list"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + CampaignList []Campaign `protobuf:"bytes,2,rep,name=campaign_list,json=campaignList,proto3" json:"campaign_list"` + RewardList []Reward `protobuf:"bytes,3,rep,name=reward_list,json=rewardList,proto3" json:"reward_list"` + RewardByRecCatList []RewardByCategory `protobuf:"bytes,4,rep,name=reward_by_rec_cat_list,json=rewardByRecCatList,proto3" json:"reward_by_rec_cat_list"` + RewardByCampaignList []RewardByCampaign `protobuf:"bytes,5,rep,name=reward_by_campaign_list,json=rewardByCampaignList,proto3" json:"reward_by_campaign_list"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -76,6 +79,27 @@ func (m *GenesisState) GetCampaignList() []Campaign { return nil } +func (m *GenesisState) GetRewardList() []Reward { + if m != nil { + return m.RewardList + } + return nil +} + +func (m *GenesisState) GetRewardByRecCatList() []RewardByCategory { + if m != nil { + return m.RewardByRecCatList + } + return nil +} + +func (m *GenesisState) GetRewardByCampaignList() []RewardByCampaign { + if m != nil { + return m.RewardByCampaignList + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "sgenetwork.sge.reward.GenesisState") } @@ -83,23 +107,29 @@ func init() { func init() { proto.RegisterFile("sge/reward/genesis.proto", fileDescriptor_cf3f52dafc32b537) } var fileDescriptor_cf3f52dafc32b537 = []byte{ - // 245 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0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, 0x0c, - 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x69, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, - 0xea, 0x17, 0xa7, 0xa7, 0xea, 0x42, 0x4d, 0x06, 0xb1, 0xf5, 0x2b, 0x60, 0xfe, 0x2c, 0xa9, 0x2c, - 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xfb, 0xd2, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xd8, 0x4d, 0x2c, - 0x4a, 0x62, 0x01, 0x00, 0x00, + // 337 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xb1, 0x4e, 0xf3, 0x30, + 0x10, 0xc7, 0x93, 0xaf, 0xfd, 0x3a, 0xb8, 0x65, 0x89, 0x0a, 0x0d, 0x91, 0x70, 0x2b, 0x16, 0xca, + 0x80, 0x23, 0x95, 0x91, 0xad, 0x41, 0x42, 0x42, 0x0c, 0x28, 0x6c, 0x2c, 0x91, 0x93, 0x5a, 0x26, + 0x82, 0xd4, 0x91, 0x6d, 0x54, 0xf2, 0x16, 0x3c, 0x05, 0xcf, 0xd2, 0xb1, 0x23, 0x13, 0x42, 0xc9, + 0x8b, 0xa0, 0xd8, 0x8e, 0x68, 0x51, 0x8b, 0x98, 0xee, 0x72, 0xf7, 0xbf, 0xdf, 0xff, 0xe2, 0x03, + 0xae, 0xa0, 0xc4, 0xe7, 0x64, 0x81, 0xf9, 0xcc, 0xa7, 0x64, 0x4e, 0x44, 0x2a, 0x50, 0xce, 0x99, + 0x64, 0xce, 0xbe, 0xa8, 0xbf, 0xe5, 0x82, 0xf1, 0x47, 0x24, 0x28, 0x41, 0x5a, 0xe4, 0xf5, 0x29, + 0xa3, 0x4c, 0x29, 0xfc, 0x3a, 0xd3, 0x62, 0x6f, 0xb0, 0x86, 0xc9, 0x31, 0xc7, 0x99, 0x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 0x53, 0x9d, 0xfb, 0x2f, 0xcd, 0xd1, 0x65, 0x91, 0x13, 0x11, 0x77, + 0xd4, 0xd1, 0xcf, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0xab, 0x9c, 0xaa, 0xf0, 0x8a, 0x02, 0x00, + 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -122,6 +152,48 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.RewardByCampaignList) > 0 { + for iNdEx := len(m.RewardByCampaignList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardByCampaignList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.RewardByRecCatList) > 0 { + for iNdEx := len(m.RewardByRecCatList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardByRecCatList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.RewardList) > 0 { + for iNdEx := len(m.RewardList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RewardList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } if len(m.CampaignList) > 0 { for iNdEx := len(m.CampaignList) - 1; iNdEx >= 0; iNdEx-- { { @@ -174,6 +246,24 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if len(m.RewardList) > 0 { + for _, e := range m.RewardList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.RewardByRecCatList) > 0 { + for _, e := range m.RewardByRecCatList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.RewardByCampaignList) > 0 { + for _, e := range m.RewardByCampaignList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } return n } @@ -279,6 +369,108 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardList = append(m.RewardList, Reward{}) + if err := m.RewardList[len(m.RewardList)-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 RewardByRecCatList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardByRecCatList = append(m.RewardByRecCatList, RewardByCategory{}) + if err := m.RewardByRecCatList[len(m.RewardByRecCatList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardByCampaignList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RewardByCampaignList = append(m.RewardByCampaignList, RewardByCampaign{}) + if err := m.RewardByCampaignList[len(m.RewardByCampaignList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/reward/types/genesis_test.go b/x/reward/types/genesis_test.go index cf896403..7af97527 100644 --- a/x/reward/types/genesis_test.go +++ b/x/reward/types/genesis_test.go @@ -10,7 +10,7 @@ import ( ) func TestGenesisState_Validate(t *testing.T) { - dupplicateCampaign := uuid.NewString() + dupplicateUID := uuid.NewString() for _, tc := range []struct { desc string genState *types.GenesisState @@ -32,6 +32,30 @@ func TestGenesisState_Validate(t *testing.T) { UID: uuid.NewString(), }, }, + RewardList: []types.Reward{ + { + UID: uuid.NewString(), + }, + { + UID: uuid.NewString(), + }, + }, + RewardByRecCatList: []types.RewardByCategory{ + { + UID: uuid.NewString(), + }, + { + UID: uuid.NewString(), + }, + }, + RewardByCampaignList: []types.RewardByCampaign{ + { + UID: uuid.NewString(), + }, + { + UID: uuid.NewString(), + }, + }, }, valid: true, }, @@ -40,10 +64,52 @@ func TestGenesisState_Validate(t *testing.T) { genState: &types.GenesisState{ CampaignList: []types.Campaign{ { - UID: dupplicateCampaign, + UID: dupplicateUID, + }, + { + UID: dupplicateUID, + }, + }, + }, + valid: false, + }, + { + desc: "duplicated reward", + genState: &types.GenesisState{ + RewardList: []types.Reward{ + { + UID: dupplicateUID, + }, + { + UID: dupplicateUID, + }, + }, + }, + valid: false, + }, + { + desc: "duplicated reward by category", + genState: &types.GenesisState{ + RewardByRecCatList: []types.RewardByCategory{ + { + UID: dupplicateUID, + }, + { + UID: dupplicateUID, + }, + }, + }, + valid: false, + }, + { + desc: "duplicated reward by campaign", + genState: &types.GenesisState{ + RewardByCampaignList: []types.RewardByCampaign{ + { + UID: dupplicateUID, }, { - UID: dupplicateCampaign, + UID: dupplicateUID, }, }, },