diff --git a/Makefile b/Makefile index 300d6b3d43..a833ea6ad5 100644 --- a/Makefile +++ b/Makefile @@ -162,7 +162,7 @@ setup-ics: ############################################################################### ### LocalNet ### ############################################################################### -start-local-node: +start-local-node: build @bash scripts/start_local_node.sh ############################################################################### diff --git a/proto/stride/airdrop/tx.proto b/proto/stride/airdrop/tx.proto index 7f381832e6..fc29eba968 100644 --- a/proto/stride/airdrop/tx.proto +++ b/proto/stride/airdrop/tx.proto @@ -13,7 +13,7 @@ service Msg { // User facing messages: // User transaction to claim all the pending daily airdrop rewards - rpc Claim(MsgClaim) returns (MsgClaimResponse); + rpc ClaimDaily(MsgClaimDaily) returns (MsgClaimDailyResponse); // User transaction to claim half of their total amount now, and forfeit the // other half to be clawed back @@ -28,21 +28,27 @@ service Msg { // TODO } -// Claim -message MsgClaim { +// ClaimDaily +message MsgClaimDaily { option (cosmos.msg.v1.signer) = "claimer"; - option (amino.name) = "airdrop/MsgClaim"; + option (amino.name) = "airdrop/MsgClaimDaily"; + // Address of the claimer string claimer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Airdrop ID + string airdrop_id = 2; } -message MsgClaimResponse {} +message MsgClaimDailyResponse {} // ClaimEarly message MsgClaimEarly { option (cosmos.msg.v1.signer) = "claimer"; option (amino.name) = "airdrop/MsgClaimEarly"; + // Address of the claimer string claimer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Airdrop ID + string airdrop_id = 2; } message MsgClaimEarlyResponse {} @@ -51,6 +57,11 @@ message MsgClaimAndStake { option (cosmos.msg.v1.signer) = "claimer"; option (amino.name) = "airdrop/MsgClaimAndStake"; + // Address of the claimer string claimer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Airdrop ID + string airdrop_id = 2; + // Validator address to delegate to when staking + string validator_address = 3; } message MsgClaimAndStakeResponse {} diff --git a/x/airdrop/client/cli/tx.go b/x/airdrop/client/cli/tx.go index a3be87a34c..9faf64d7f0 100644 --- a/x/airdrop/client/cli/tx.go +++ b/x/airdrop/client/cli/tx.go @@ -2,8 +2,12 @@ package cli import ( "fmt" + "strings" "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/version" "github.com/spf13/cobra" "github.com/Stride-Labs/stride/v22/x/airdrop/types" @@ -19,7 +23,134 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand() + cmd.AddCommand( + CmdClaimDaily(), + CmdClaimEarly(), + CmdClaimAndStake(), + ) + + return cmd +} + +// User transaction to claim all the pending airdrop rewards up to the current day +func CmdClaimDaily() *cobra.Command { + cmd := &cobra.Command{ + Use: "claim-daily [airdrop-id]", + Short: "Claims all the pending airdrop rewards up to the current day", + Long: strings.TrimSpace( + fmt.Sprintf(`Claims all pending airdrop rewards up to the current day. +This option is only available if the user has not already elected to claim and stake or claim early + +Example: + $ %[1]s tx %[2]s claim-daily airdrop-1 --from user +`, version.AppName, types.ModuleName), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + airdropId := args[0] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgClaimDaily( + clientCtx.GetFromAddress().String(), + airdropId, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +// User transaction to claim half of their total amount now, and forfeit the other half to be clawed back +func CmdClaimEarly() *cobra.Command { + cmd := &cobra.Command{ + Use: "claim-early [airdrop-id]", + Short: "Claims rewards immediately, but with a early claim penalty", + Long: strings.TrimSpace( + fmt.Sprintf(`Claims rewards immediately (including for future days), but with an early +claim penalty causing a portion of the total to be clawed back. + +Example: + $ %[1]s tx %[2]s claim-early airdrop-1 --from user +`, version.AppName, types.ModuleName), + ), + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + airdropId := args[0] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgClaimEarly( + clientCtx.GetFromAddress().String(), + airdropId, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} + +// User transaction to claim and stake the full airdrop amount +// The rewards will be locked until the end of the distribution period, but will recieve rewards throughout this time +func CmdClaimAndStake() *cobra.Command { + cmd := &cobra.Command{ + Use: "claim-and-stake [airdrop-id] [validator-address]", + Short: "Claims and stakes the total reward amount", + Long: strings.TrimSpace( + fmt.Sprintf(`Claims and stakes the full airdrop amount. +The rewards will be locked until the end of the distribution period, but will accrue rewards throughout this time + +Example: + $ %[1]s tx %[2]s claim-early airdrop-1 stridevaloperX --from user +`, version.AppName, types.ModuleName), + ), + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) error { + airdropId := args[0] + vaildatorAddress := args[1] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgClaimAndStake( + clientCtx.GetFromAddress().String(), + airdropId, + vaildatorAddress, + ) + + if err := msg.ValidateBasic(); err != nil { + return err + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) return cmd } diff --git a/x/airdrop/keeper/airdrop_test.go b/x/airdrop/keeper/airdrop_test.go index 567b81e775..5ebf2551a7 100644 --- a/x/airdrop/keeper/airdrop_test.go +++ b/x/airdrop/keeper/airdrop_test.go @@ -11,8 +11,9 @@ import ( func (s *KeeperTestSuite) addAirdrops() (airdrops []types.Airdrop) { for i := 0; i <= 4; i++ { airdrop := types.Airdrop{ - Id: fmt.Sprintf("airdrop-%d", i), - EarlyClaimPenalty: sdk.ZeroDec(), + Id: fmt.Sprintf("airdrop-%d", i), + EarlyClaimPenalty: sdk.ZeroDec(), + ClaimAndStakeBonus: sdk.ZeroDec(), } airdrops = append(airdrops, airdrop) s.App.AirdropKeeper.SetAirdrop(s.Ctx, airdrop) diff --git a/x/airdrop/keeper/claim.go b/x/airdrop/keeper/claim.go index 8ddb149298..d7b9d78191 100644 --- a/x/airdrop/keeper/claim.go +++ b/x/airdrop/keeper/claim.go @@ -4,7 +4,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func (k Keeper) Claim(ctx sdk.Context, claimer string) error { +func (k Keeper) ClaimDaily(ctx sdk.Context, claimer string) error { // TODO[airdrop] implement logic return nil diff --git a/x/airdrop/keeper/msg_server.go b/x/airdrop/keeper/msg_server.go index f5465a5274..c56d480bbb 100644 --- a/x/airdrop/keeper/msg_server.go +++ b/x/airdrop/keeper/msg_server.go @@ -20,20 +20,19 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { var _ types.MsgServer = msgServer{} -// User transaction to claim all the pending daily airdrop rewards -func (ms msgServer) Claim(goCtx context.Context, msg *types.MsgClaim) (*types.MsgClaimResponse, error) { +// User transaction to claim all the pending airdrop rewards up to the current day +func (ms msgServer) ClaimDaily(goCtx context.Context, msg *types.MsgClaimDaily) (*types.MsgClaimDailyResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - err := ms.Keeper.Claim(ctx, msg.Claimer) + err := ms.Keeper.ClaimDaily(ctx, msg.Claimer) if err != nil { return nil, err } - return &types.MsgClaimResponse{}, nil + return &types.MsgClaimDailyResponse{}, nil } -// User transaction to claim half of their total amount now, and forfeit the -// other half to be clawed back +// User transaction to claim half of their total amount now, and forfeit the other half to be clawed back func (ms msgServer) ClaimEarly(goCtx context.Context, msg *types.MsgClaimEarly) (*types.MsgClaimEarlyResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) @@ -45,8 +44,8 @@ func (ms msgServer) ClaimEarly(goCtx context.Context, msg *types.MsgClaimEarly) return &types.MsgClaimEarlyResponse{}, nil } -// User transaction to claim and automatically lock stake their whole airdrop -// amount now. The funds can be unstaked by the user once the airdrop is over +// User transaction to claim and stake the full airdrop amount +// The rewards will be locked until the end of the distribution period, but will recieve rewards throughout this time func (ms msgServer) ClaimAndStake(goCtx context.Context, msg *types.MsgClaimAndStake) (*types.MsgClaimAndStakeResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) diff --git a/x/airdrop/types/codec.go b/x/airdrop/types/codec.go index edfc27f8d6..bebbfe44ca 100644 --- a/x/airdrop/types/codec.go +++ b/x/airdrop/types/codec.go @@ -10,7 +10,7 @@ import ( ) func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - legacy.RegisterAminoMsg(cdc, &MsgClaim{}, "airdrop/MsgClaim") + legacy.RegisterAminoMsg(cdc, &MsgClaimDaily{}, "airdrop/MsgClaimDaily") legacy.RegisterAminoMsg(cdc, &MsgClaimEarly{}, "airdrop/MsgClaimEarly") legacy.RegisterAminoMsg(cdc, &MsgClaimAndStake{}, "airdrop/MsgClaimAndStake") // TODO[airdrop]: add admin messages @@ -18,7 +18,7 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgClaim{}, + &MsgClaimDaily{}, &MsgClaimEarly{}, &MsgClaimAndStake{}, // TODO[airdrop]: add admin messages diff --git a/x/airdrop/types/msgs.go b/x/airdrop/types/msgs.go index cce4e09a09..f9e0c628ab 100644 --- a/x/airdrop/types/msgs.go +++ b/x/airdrop/types/msgs.go @@ -1,6 +1,8 @@ package types import ( + "errors" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -8,18 +10,18 @@ import ( ) const ( - TypeMsgClaim = "claim" + TypeMsgClaim = "claim_daily" TypeMsgClaimAndStake = "claim_and_stake" TypeMsgClaimEarly = "claim_early" ) var ( - _ sdk.Msg = &MsgClaim{} + _ sdk.Msg = &MsgClaimDaily{} _ sdk.Msg = &MsgClaimAndStake{} _ sdk.Msg = &MsgClaimEarly{} // Implement legacy interface for ledger support - _ legacytx.LegacyMsg = &MsgClaim{} + _ legacytx.LegacyMsg = &MsgClaimDaily{} _ legacytx.LegacyMsg = &MsgClaimAndStake{} _ legacytx.LegacyMsg = &MsgClaimEarly{} ) @@ -28,21 +30,22 @@ var ( // MsgClaim // ---------------------------------------------- -func NewMsgClaim(claimer string) *MsgClaim { - return &MsgClaim{ - Claimer: claimer, +func NewMsgClaimDaily(claimer, airdropId string) *MsgClaimDaily { + return &MsgClaimDaily{ + Claimer: claimer, + AirdropId: airdropId, } } -func (msg MsgClaim) Type() string { +func (msg MsgClaimDaily) Type() string { return TypeMsgClaim } -func (msg MsgClaim) Route() string { +func (msg MsgClaimDaily) Route() string { return RouterKey } -func (msg *MsgClaim) GetSigners() []sdk.AccAddress { +func (msg *MsgClaimDaily) GetSigners() []sdk.AccAddress { claimer, err := sdk.AccAddressFromBech32(msg.Claimer) if err != nil { panic(err) @@ -50,39 +53,42 @@ func (msg *MsgClaim) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{claimer} } -func (msg *MsgClaim) GetSignBytes() []byte { +func (msg *MsgClaimDaily) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } -func (msg *MsgClaim) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Claimer) - if err != nil { +func (msg *MsgClaimDaily) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Claimer); err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address (%s)", err) } + if msg.AirdropId == "" { + return errors.New("airdrop-id must be specified") + } return nil } // ---------------------------------------------- -// MsgClaimAndStake +// MsgClaimEarly // ---------------------------------------------- -func NewMsgClaimAndStake(claimer string) *MsgClaimAndStake { - return &MsgClaimAndStake{ - Claimer: claimer, +func NewMsgClaimEarly(claimer, airdropId string) *MsgClaimEarly { + return &MsgClaimEarly{ + Claimer: claimer, + AirdropId: airdropId, } } -func (msg MsgClaimAndStake) Type() string { - return TypeMsgClaimAndStake +func (msg MsgClaimEarly) Type() string { + return TypeMsgClaimEarly } -func (msg MsgClaimAndStake) Route() string { +func (msg MsgClaimEarly) Route() string { return RouterKey } -func (msg *MsgClaimAndStake) GetSigners() []sdk.AccAddress { +func (msg *MsgClaimEarly) GetSigners() []sdk.AccAddress { claimer, err := sdk.AccAddressFromBech32(msg.Claimer) if err != nil { panic(err) @@ -90,39 +96,43 @@ func (msg *MsgClaimAndStake) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{claimer} } -func (msg *MsgClaimAndStake) GetSignBytes() []byte { +func (msg *MsgClaimEarly) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } -func (msg *MsgClaimAndStake) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Claimer) - if err != nil { +func (msg *MsgClaimEarly) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Claimer); err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address (%s)", err) } + if msg.AirdropId == "" { + return errors.New("airdrop-id must be specified") + } return nil } // ---------------------------------------------- -// MsgClaimEarly +// MsgClaimAndStake // ---------------------------------------------- -func NewMsgClaimEarly(claimer string) *MsgClaimEarly { - return &MsgClaimEarly{ - Claimer: claimer, +func NewMsgClaimAndStake(claimer, airdropId, validatorAddress string) *MsgClaimAndStake { + return &MsgClaimAndStake{ + Claimer: claimer, + AirdropId: airdropId, + ValidatorAddress: validatorAddress, } } -func (msg MsgClaimEarly) Type() string { - return TypeMsgClaimEarly +func (msg MsgClaimAndStake) Type() string { + return TypeMsgClaimAndStake } -func (msg MsgClaimEarly) Route() string { +func (msg MsgClaimAndStake) Route() string { return RouterKey } -func (msg *MsgClaimEarly) GetSigners() []sdk.AccAddress { +func (msg *MsgClaimAndStake) GetSigners() []sdk.AccAddress { claimer, err := sdk.AccAddressFromBech32(msg.Claimer) if err != nil { panic(err) @@ -130,16 +140,21 @@ func (msg *MsgClaimEarly) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{claimer} } -func (msg *MsgClaimEarly) GetSignBytes() []byte { +func (msg *MsgClaimAndStake) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } -func (msg *MsgClaimEarly) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Claimer) - if err != nil { +func (msg *MsgClaimAndStake) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Claimer); err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid address (%s)", err) } + if msg.AirdropId == "" { + return errors.New("airdrop-id must be specified") + } + if _, err := sdk.ValAddressFromBech32(msg.ValidatorAddress); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid validator address (%s)", err) + } return nil } diff --git a/x/airdrop/types/msgs_test.go b/x/airdrop/types/msgs_test.go new file mode 100644 index 0000000000..241239481e --- /dev/null +++ b/x/airdrop/types/msgs_test.go @@ -0,0 +1,207 @@ +package types_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/Stride-Labs/stride/v22/app/apptesting" + "github.com/Stride-Labs/stride/v22/x/airdrop/types" +) + +// ---------------------------------------------- +// MsgClaimDaily +// ---------------------------------------------- + +func TestMsgClaimDaily_ValidateBasic(t *testing.T) { + apptesting.SetupConfig() + + validAddress, invalidAddress := apptesting.GenerateTestAddrs() + validAirdropId := "airdrop-1" + + tests := []struct { + name string + msg types.MsgClaimDaily + expectedError string + }{ + { + name: "valid message", + msg: types.MsgClaimDaily{ + Claimer: validAddress, + AirdropId: validAirdropId, + }, + }, + { + name: "invalid address", + msg: types.MsgClaimDaily{ + Claimer: invalidAddress, + AirdropId: validAirdropId, + }, + expectedError: "invalid address", + }, + { + name: "invalid address", + msg: types.MsgClaimDaily{ + Claimer: validAddress, + AirdropId: "", + }, + expectedError: "airdrop-id must be specified", + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + actualError := tc.msg.ValidateBasic() + if tc.expectedError != "" { + require.ErrorContains(t, actualError, tc.expectedError) + return + } + require.NoError(t, actualError) + }) + } +} + +func TestMsgClaimDaily_GetSignBytes(t *testing.T) { + addr := "strideXXX" + airdropId := "airdrop" + msg := types.NewMsgClaimDaily(addr, airdropId) + res := msg.GetSignBytes() + + expected := `{"type":"airdrop/MsgClaimDaily","value":{"airdrop_id":"airdrop","claimer":"strideXXX"}}` + require.Equal(t, expected, string(res)) +} + +// ---------------------------------------------- +// MsgClaimEarly +// ---------------------------------------------- + +func TestMsgClaimEarly_ValidateBasic(t *testing.T) { + apptesting.SetupConfig() + + validAddress, invalidAddress := apptesting.GenerateTestAddrs() + validAirdropId := "airdrop-1" + + tests := []struct { + name string + msg types.MsgClaimEarly + expectedError string + }{ + { + name: "valid message", + msg: types.MsgClaimEarly{ + Claimer: validAddress, + AirdropId: validAirdropId, + }, + }, + { + name: "invalid address", + msg: types.MsgClaimEarly{ + Claimer: invalidAddress, + AirdropId: validAirdropId, + }, + expectedError: "invalid address", + }, + { + name: "invalid address", + msg: types.MsgClaimEarly{ + Claimer: validAddress, + AirdropId: "", + }, + expectedError: "airdrop-id must be specified", + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + actualError := tc.msg.ValidateBasic() + if tc.expectedError != "" { + require.ErrorContains(t, actualError, tc.expectedError) + return + } + require.NoError(t, actualError) + }) + } +} + +func TestMsgClaimEarly_GetSignBytes(t *testing.T) { + addr := "strideXXX" + airdropId := "airdrop" + msg := types.NewMsgClaimEarly(addr, airdropId) + res := msg.GetSignBytes() + + expected := `{"type":"airdrop/MsgClaimEarly","value":{"airdrop_id":"airdrop","claimer":"strideXXX"}}` + require.Equal(t, expected, string(res)) +} + +// ---------------------------------------------- +// MsgClaimAndStake +// ---------------------------------------------- + +func TestMsgClaimAndStake_ValidateBasic(t *testing.T) { + apptesting.SetupConfig() + + validAddress, invalidAddress := apptesting.GenerateTestAddrs() + validAirdropId := "airdrop-1" + validValidatorAddress := "stridevaloper17kht2x2ped6qytr2kklevtvmxpw7wq9rcfud5c" + + tests := []struct { + name string + msg types.MsgClaimAndStake + expectedError string + }{ + { + name: "valid message", + msg: types.MsgClaimAndStake{ + Claimer: validAddress, + AirdropId: validAirdropId, + ValidatorAddress: validValidatorAddress, + }, + }, + { + name: "invalid address", + msg: types.MsgClaimAndStake{ + Claimer: invalidAddress, + AirdropId: validAirdropId, + ValidatorAddress: validValidatorAddress, + }, + expectedError: "invalid address", + }, + { + name: "invalid address", + msg: types.MsgClaimAndStake{ + Claimer: validAddress, + AirdropId: "", + ValidatorAddress: validValidatorAddress, + }, + expectedError: "airdrop-id must be specified", + }, + { + name: "invalid address", + msg: types.MsgClaimAndStake{ + Claimer: validAddress, + AirdropId: validAirdropId, + ValidatorAddress: "stridevaloper17kht2x2p", + }, + expectedError: "invalid validator address", + }, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + actualError := tc.msg.ValidateBasic() + if tc.expectedError != "" { + require.ErrorContains(t, actualError, tc.expectedError) + return + } + require.NoError(t, actualError) + }) + } +} + +func TestMsgClaimAndStake_GetSignBytes(t *testing.T) { + addr := "strideXXX" + airdropId := "airdrop" + validatorAddress := "stridevaloperYYY" + msg := types.NewMsgClaimAndStake(addr, airdropId, validatorAddress) + res := msg.GetSignBytes() + + expected := `{"type":"airdrop/MsgClaimAndStake","value":{"airdrop_id":"airdrop","claimer":"strideXXX","validator_address":"stridevaloperYYY"}}` + require.Equal(t, expected, string(res)) +} diff --git a/x/airdrop/types/tx.pb.go b/x/airdrop/types/tx.pb.go index ad8160a11f..4164cf4a75 100644 --- a/x/airdrop/types/tx.pb.go +++ b/x/airdrop/types/tx.pb.go @@ -30,23 +30,26 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Claim -type MsgClaim struct { +// ClaimDaily +type MsgClaimDaily struct { + // Address of the claimer Claimer string `protobuf:"bytes,1,opt,name=claimer,proto3" json:"claimer,omitempty"` + // Airdrop ID + AirdropId string `protobuf:"bytes,2,opt,name=airdrop_id,json=airdropId,proto3" json:"airdrop_id,omitempty"` } -func (m *MsgClaim) Reset() { *m = MsgClaim{} } -func (m *MsgClaim) String() string { return proto.CompactTextString(m) } -func (*MsgClaim) ProtoMessage() {} -func (*MsgClaim) Descriptor() ([]byte, []int) { +func (m *MsgClaimDaily) Reset() { *m = MsgClaimDaily{} } +func (m *MsgClaimDaily) String() string { return proto.CompactTextString(m) } +func (*MsgClaimDaily) ProtoMessage() {} +func (*MsgClaimDaily) Descriptor() ([]byte, []int) { return fileDescriptor_40a6837f542f43b8, []int{0} } -func (m *MsgClaim) XXX_Unmarshal(b []byte) error { +func (m *MsgClaimDaily) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgClaimDaily) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgClaim.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgClaimDaily.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -56,40 +59,47 @@ func (m *MsgClaim) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *MsgClaim) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgClaim.Merge(m, src) +func (m *MsgClaimDaily) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaimDaily.Merge(m, src) } -func (m *MsgClaim) XXX_Size() int { +func (m *MsgClaimDaily) XXX_Size() int { return m.Size() } -func (m *MsgClaim) XXX_DiscardUnknown() { - xxx_messageInfo_MsgClaim.DiscardUnknown(m) +func (m *MsgClaimDaily) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaimDaily.DiscardUnknown(m) } -var xxx_messageInfo_MsgClaim proto.InternalMessageInfo +var xxx_messageInfo_MsgClaimDaily proto.InternalMessageInfo -func (m *MsgClaim) GetClaimer() string { +func (m *MsgClaimDaily) GetClaimer() string { if m != nil { return m.Claimer } return "" } -type MsgClaimResponse struct { +func (m *MsgClaimDaily) GetAirdropId() string { + if m != nil { + return m.AirdropId + } + return "" +} + +type MsgClaimDailyResponse struct { } -func (m *MsgClaimResponse) Reset() { *m = MsgClaimResponse{} } -func (m *MsgClaimResponse) String() string { return proto.CompactTextString(m) } -func (*MsgClaimResponse) ProtoMessage() {} -func (*MsgClaimResponse) Descriptor() ([]byte, []int) { +func (m *MsgClaimDailyResponse) Reset() { *m = MsgClaimDailyResponse{} } +func (m *MsgClaimDailyResponse) String() string { return proto.CompactTextString(m) } +func (*MsgClaimDailyResponse) ProtoMessage() {} +func (*MsgClaimDailyResponse) Descriptor() ([]byte, []int) { return fileDescriptor_40a6837f542f43b8, []int{1} } -func (m *MsgClaimResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgClaimDailyResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgClaimResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgClaimDailyResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgClaimResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgClaimDailyResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -99,21 +109,24 @@ func (m *MsgClaimResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *MsgClaimResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgClaimResponse.Merge(m, src) +func (m *MsgClaimDailyResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgClaimDailyResponse.Merge(m, src) } -func (m *MsgClaimResponse) XXX_Size() int { +func (m *MsgClaimDailyResponse) XXX_Size() int { return m.Size() } -func (m *MsgClaimResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgClaimResponse.DiscardUnknown(m) +func (m *MsgClaimDailyResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgClaimDailyResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgClaimResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgClaimDailyResponse proto.InternalMessageInfo // ClaimEarly type MsgClaimEarly struct { + // Address of the claimer Claimer string `protobuf:"bytes,1,opt,name=claimer,proto3" json:"claimer,omitempty"` + // Airdrop ID + AirdropId string `protobuf:"bytes,2,opt,name=airdrop_id,json=airdropId,proto3" json:"airdrop_id,omitempty"` } func (m *MsgClaimEarly) Reset() { *m = MsgClaimEarly{} } @@ -156,6 +169,13 @@ func (m *MsgClaimEarly) GetClaimer() string { return "" } +func (m *MsgClaimEarly) GetAirdropId() string { + if m != nil { + return m.AirdropId + } + return "" +} + type MsgClaimEarlyResponse struct { } @@ -194,7 +214,12 @@ var xxx_messageInfo_MsgClaimEarlyResponse proto.InternalMessageInfo // ClaimAndStake type MsgClaimAndStake struct { + // Address of the claimer Claimer string `protobuf:"bytes,1,opt,name=claimer,proto3" json:"claimer,omitempty"` + // Airdrop ID + AirdropId string `protobuf:"bytes,2,opt,name=airdrop_id,json=airdropId,proto3" json:"airdrop_id,omitempty"` + // Validator address to delegate to when staking + ValidatorAddress string `protobuf:"bytes,3,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` } func (m *MsgClaimAndStake) Reset() { *m = MsgClaimAndStake{} } @@ -237,6 +262,20 @@ func (m *MsgClaimAndStake) GetClaimer() string { return "" } +func (m *MsgClaimAndStake) GetAirdropId() string { + if m != nil { + return m.AirdropId + } + return "" +} + +func (m *MsgClaimAndStake) GetValidatorAddress() string { + if m != nil { + return m.ValidatorAddress + } + return "" +} + type MsgClaimAndStakeResponse struct { } @@ -274,8 +313,8 @@ func (m *MsgClaimAndStakeResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgClaimAndStakeResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgClaim)(nil), "stride.airdrop.MsgClaim") - proto.RegisterType((*MsgClaimResponse)(nil), "stride.airdrop.MsgClaimResponse") + proto.RegisterType((*MsgClaimDaily)(nil), "stride.airdrop.MsgClaimDaily") + proto.RegisterType((*MsgClaimDailyResponse)(nil), "stride.airdrop.MsgClaimDailyResponse") proto.RegisterType((*MsgClaimEarly)(nil), "stride.airdrop.MsgClaimEarly") proto.RegisterType((*MsgClaimEarlyResponse)(nil), "stride.airdrop.MsgClaimEarlyResponse") proto.RegisterType((*MsgClaimAndStake)(nil), "stride.airdrop.MsgClaimAndStake") @@ -285,31 +324,33 @@ func init() { func init() { proto.RegisterFile("stride/airdrop/tx.proto", fileDescriptor_40a6837f542f43b8) } var fileDescriptor_40a6837f542f43b8 = []byte{ - // 372 bytes of a gzipped FileDescriptorProto + // 412 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0x2e, 0x29, 0xca, 0x4c, 0x49, 0xd5, 0x4f, 0xcc, 0x2c, 0x4a, 0x29, 0xca, 0x2f, 0xd0, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x83, 0x48, 0xe8, 0x41, 0x25, 0xa4, 0xc4, 0x93, 0xf3, 0x8b, 0x73, 0xf3, 0x8b, 0xf5, 0x73, 0x8b, 0xd3, 0xf5, 0xcb, 0x0c, 0x41, 0x14, 0x44, 0xa1, 0x94, 0x60, 0x62, 0x6e, 0x66, 0x5e, 0xbe, 0x3e, 0x98, 0x84, 0x0a, 0x49, 0x42, 0xd4, 0xc6, 0x83, 0x79, 0xfa, 0x10, - 0x0e, 0x44, 0x4a, 0x29, 0x91, 0x8b, 0xc3, 0xb7, 0x38, 0xdd, 0x39, 0x27, 0x31, 0x33, 0x57, 0xc8, - 0x88, 0x8b, 0x3d, 0x19, 0xc4, 0x48, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x74, 0x92, 0xb8, - 0xb4, 0x45, 0x57, 0x04, 0xaa, 0xdc, 0x31, 0x25, 0xa5, 0x28, 0xb5, 0xb8, 0x38, 0xb8, 0xa4, 0x28, - 0x33, 0x2f, 0x3d, 0x08, 0xa6, 0xd0, 0x4a, 0xb1, 0xe9, 0xf9, 0x06, 0x2d, 0x18, 0xaf, 0xeb, 0xf9, - 0x06, 0x2d, 0x01, 0x98, 0xcb, 0x61, 0xc6, 0x2a, 0x09, 0x71, 0x09, 0xc0, 0xd8, 0x41, 0xa9, 0xc5, - 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x4a, 0xd9, 0x5c, 0xbc, 0x30, 0x31, 0xd7, 0xc4, 0xa2, 0x9c, 0x4a, - 0xb2, 0xec, 0x56, 0x43, 0xb7, 0x5b, 0x14, 0xdd, 0x6e, 0xb0, 0xd9, 0x4a, 0xe2, 0x5c, 0xa2, 0x28, - 0x02, 0x70, 0x57, 0x14, 0x22, 0x5c, 0xe6, 0x98, 0x97, 0x12, 0x5c, 0x92, 0x98, 0x9d, 0x4a, 0x96, - 0x43, 0x34, 0xd1, 0x1d, 0x22, 0x81, 0xee, 0x10, 0x98, 0xf1, 0x4a, 0x52, 0x5c, 0x12, 0xe8, 0x62, - 0x30, 0xe7, 0x18, 0xfd, 0x66, 0xe4, 0x62, 0xf6, 0x2d, 0x4e, 0x17, 0x72, 0xe6, 0x62, 0x85, 0x44, - 0x88, 0x84, 0x1e, 0x6a, 0xa4, 0xeb, 0xc1, 0xb4, 0x4a, 0x29, 0xe0, 0x92, 0x81, 0x19, 0x26, 0x14, - 0xc4, 0xc5, 0x85, 0x14, 0xbc, 0xb2, 0xb8, 0xd4, 0x83, 0xa5, 0xa5, 0x54, 0xf1, 0x4a, 0xc3, 0xcd, - 0x8c, 0xe6, 0xe2, 0x45, 0x0d, 0x2c, 0x9c, 0xce, 0x80, 0xa9, 0x90, 0xd2, 0x20, 0xa4, 0x02, 0x66, - 0xb8, 0x93, 0xf7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, - 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0x19, 0xa6, 0x67, - 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x07, 0x83, 0x4d, 0xd3, 0xf5, 0x49, 0x4c, - 0x2a, 0xd6, 0x87, 0x66, 0x95, 0x32, 0x23, 0x23, 0xfd, 0x0a, 0x44, 0x86, 0xa9, 0x2c, 0x48, 0x2d, - 0x4e, 0x62, 0x03, 0xa7, 0x6e, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x60, 0x2e, 0x72, 0x51, - 0x4f, 0x03, 0x00, 0x00, + 0x0e, 0x44, 0x4a, 0xa9, 0x8b, 0x91, 0x8b, 0xd7, 0xb7, 0x38, 0xdd, 0x39, 0x27, 0x31, 0x33, 0xd7, + 0x25, 0x31, 0x33, 0xa7, 0x52, 0xc8, 0x88, 0x8b, 0x3d, 0x19, 0xc4, 0x4b, 0x2d, 0x92, 0x60, 0x54, + 0x60, 0xd4, 0xe0, 0x74, 0x92, 0xb8, 0xb4, 0x45, 0x57, 0x04, 0xaa, 0xc9, 0x31, 0x25, 0xa5, 0x28, + 0xb5, 0xb8, 0x38, 0xb8, 0xa4, 0x28, 0x33, 0x2f, 0x3d, 0x08, 0xa6, 0x50, 0x48, 0x96, 0x8b, 0x0b, + 0xea, 0xae, 0xf8, 0xcc, 0x14, 0x09, 0x26, 0x90, 0xb6, 0x20, 0x4e, 0xa8, 0x88, 0x67, 0x8a, 0x95, + 0x5a, 0xd3, 0xf3, 0x0d, 0x5a, 0x30, 0xc5, 0x5d, 0xcf, 0x37, 0x68, 0x89, 0xc2, 0xbc, 0x87, 0x62, + 0xb5, 0x92, 0x38, 0x97, 0x28, 0x8a, 0x40, 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x8a, + 0x2b, 0x5d, 0x13, 0x8b, 0x06, 0xca, 0x95, 0x60, 0xab, 0x91, 0x5d, 0x09, 0x16, 0x80, 0xbb, 0x72, + 0x2f, 0x23, 0x97, 0x00, 0x4c, 0xc6, 0x31, 0x2f, 0x25, 0xb8, 0x24, 0x31, 0x3b, 0x95, 0x06, 0x0e, + 0x15, 0xd2, 0xe6, 0x12, 0x2c, 0x4b, 0xcc, 0xc9, 0x4c, 0x49, 0x2c, 0xc9, 0x2f, 0x8a, 0x4f, 0x84, + 0x18, 0x21, 0xc1, 0x0c, 0x56, 0x25, 0x00, 0x97, 0x80, 0x1a, 0x6d, 0xa5, 0x89, 0xee, 0x2b, 0x09, + 0x74, 0x5f, 0xc1, 0x9c, 0xaa, 0x24, 0xc5, 0x25, 0x81, 0x2e, 0x06, 0xf3, 0x9b, 0x51, 0x17, 0x13, + 0x17, 0xb3, 0x6f, 0x71, 0xba, 0x50, 0x10, 0x17, 0x17, 0x52, 0x5a, 0x91, 0xd5, 0x43, 0x4d, 0x95, + 0x7a, 0x28, 0xd1, 0x27, 0xa5, 0x8a, 0x57, 0x1a, 0x66, 0x36, 0xdc, 0x4c, 0x48, 0xcc, 0xe2, 0x34, + 0x13, 0x2c, 0x8d, 0xdb, 0x4c, 0x94, 0xb8, 0x10, 0x8a, 0xe6, 0xe2, 0x45, 0x8d, 0x07, 0x05, 0x5c, + 0xfa, 0x60, 0x2a, 0xa4, 0x34, 0x08, 0xa9, 0x80, 0x19, 0xee, 0xe4, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, + 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, + 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x86, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, + 0xb9, 0xfa, 0xc1, 0x60, 0xd3, 0x74, 0x7d, 0x12, 0x93, 0x8a, 0xf5, 0xa1, 0xb9, 0xba, 0xcc, 0xc8, + 0x48, 0xbf, 0x02, 0x91, 0xb7, 0x2b, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x19, 0xd1, 0x18, 0x10, + 0x00, 0x00, 0xff, 0xff, 0xcd, 0xdb, 0xb1, 0x0e, 0xfa, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -325,7 +366,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { // User transaction to claim all the pending daily airdrop rewards - Claim(ctx context.Context, in *MsgClaim, opts ...grpc.CallOption) (*MsgClaimResponse, error) + ClaimDaily(ctx context.Context, in *MsgClaimDaily, opts ...grpc.CallOption) (*MsgClaimDailyResponse, error) // User transaction to claim half of their total amount now, and forfeit the // other half to be clawed back ClaimEarly(ctx context.Context, in *MsgClaimEarly, opts ...grpc.CallOption) (*MsgClaimEarlyResponse, error) @@ -342,9 +383,9 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) Claim(ctx context.Context, in *MsgClaim, opts ...grpc.CallOption) (*MsgClaimResponse, error) { - out := new(MsgClaimResponse) - err := c.cc.Invoke(ctx, "/stride.airdrop.Msg/Claim", in, out, opts...) +func (c *msgClient) ClaimDaily(ctx context.Context, in *MsgClaimDaily, opts ...grpc.CallOption) (*MsgClaimDailyResponse, error) { + out := new(MsgClaimDailyResponse) + err := c.cc.Invoke(ctx, "/stride.airdrop.Msg/ClaimDaily", in, out, opts...) if err != nil { return nil, err } @@ -372,7 +413,7 @@ func (c *msgClient) ClaimAndStake(ctx context.Context, in *MsgClaimAndStake, opt // MsgServer is the server API for Msg service. type MsgServer interface { // User transaction to claim all the pending daily airdrop rewards - Claim(context.Context, *MsgClaim) (*MsgClaimResponse, error) + ClaimDaily(context.Context, *MsgClaimDaily) (*MsgClaimDailyResponse, error) // User transaction to claim half of their total amount now, and forfeit the // other half to be clawed back ClaimEarly(context.Context, *MsgClaimEarly) (*MsgClaimEarlyResponse, error) @@ -385,8 +426,8 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) Claim(ctx context.Context, req *MsgClaim) (*MsgClaimResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Claim not implemented") +func (*UnimplementedMsgServer) ClaimDaily(ctx context.Context, req *MsgClaimDaily) (*MsgClaimDailyResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ClaimDaily not implemented") } func (*UnimplementedMsgServer) ClaimEarly(ctx context.Context, req *MsgClaimEarly) (*MsgClaimEarlyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ClaimEarly not implemented") @@ -399,20 +440,20 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_Claim_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgClaim) +func _Msg_ClaimDaily_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgClaimDaily) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).Claim(ctx, in) + return srv.(MsgServer).ClaimDaily(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/stride.airdrop.Msg/Claim", + FullMethod: "/stride.airdrop.Msg/ClaimDaily", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Claim(ctx, req.(*MsgClaim)) + return srv.(MsgServer).ClaimDaily(ctx, req.(*MsgClaimDaily)) } return interceptor(ctx, in, info, handler) } @@ -458,8 +499,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "Claim", - Handler: _Msg_Claim_Handler, + MethodName: "ClaimDaily", + Handler: _Msg_ClaimDaily_Handler, }, { MethodName: "ClaimEarly", @@ -474,7 +515,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Metadata: "stride/airdrop/tx.proto", } -func (m *MsgClaim) Marshal() (dAtA []byte, err error) { +func (m *MsgClaimDaily) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -484,16 +525,23 @@ func (m *MsgClaim) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgClaim) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgClaimDaily) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgClaimDaily) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l + if len(m.AirdropId) > 0 { + i -= len(m.AirdropId) + copy(dAtA[i:], m.AirdropId) + i = encodeVarintTx(dAtA, i, uint64(len(m.AirdropId))) + i-- + dAtA[i] = 0x12 + } if len(m.Claimer) > 0 { i -= len(m.Claimer) copy(dAtA[i:], m.Claimer) @@ -504,7 +552,7 @@ func (m *MsgClaim) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgClaimResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgClaimDailyResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -514,12 +562,12 @@ func (m *MsgClaimResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgClaimResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgClaimDailyResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgClaimResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgClaimDailyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -547,6 +595,13 @@ func (m *MsgClaimEarly) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.AirdropId) > 0 { + i -= len(m.AirdropId) + copy(dAtA[i:], m.AirdropId) + i = encodeVarintTx(dAtA, i, uint64(len(m.AirdropId))) + i-- + dAtA[i] = 0x12 + } if len(m.Claimer) > 0 { i -= len(m.Claimer) copy(dAtA[i:], m.Claimer) @@ -600,6 +655,20 @@ func (m *MsgClaimAndStake) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.ValidatorAddress) > 0 { + i -= len(m.ValidatorAddress) + copy(dAtA[i:], m.ValidatorAddress) + i = encodeVarintTx(dAtA, i, uint64(len(m.ValidatorAddress))) + i-- + dAtA[i] = 0x1a + } + if len(m.AirdropId) > 0 { + i -= len(m.AirdropId) + copy(dAtA[i:], m.AirdropId) + i = encodeVarintTx(dAtA, i, uint64(len(m.AirdropId))) + i-- + dAtA[i] = 0x12 + } if len(m.Claimer) > 0 { i -= len(m.Claimer) copy(dAtA[i:], m.Claimer) @@ -644,7 +713,7 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgClaim) Size() (n int) { +func (m *MsgClaimDaily) Size() (n int) { if m == nil { return 0 } @@ -654,10 +723,14 @@ func (m *MsgClaim) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.AirdropId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } -func (m *MsgClaimResponse) Size() (n int) { +func (m *MsgClaimDailyResponse) Size() (n int) { if m == nil { return 0 } @@ -676,6 +749,10 @@ func (m *MsgClaimEarly) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.AirdropId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -698,6 +775,14 @@ func (m *MsgClaimAndStake) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = len(m.AirdropId) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.ValidatorAddress) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } return n } @@ -716,7 +801,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgClaim) Unmarshal(dAtA []byte) error { +func (m *MsgClaimDaily) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -739,10 +824,10 @@ func (m *MsgClaim) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgClaim: wiretype end group for non-group") + return fmt.Errorf("proto: MsgClaimDaily: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClaim: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgClaimDaily: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -777,6 +862,38 @@ func (m *MsgClaim) Unmarshal(dAtA []byte) error { } m.Claimer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AirdropId", 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.AirdropId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -798,7 +915,7 @@ func (m *MsgClaim) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgClaimResponse) Unmarshal(dAtA []byte) error { +func (m *MsgClaimDailyResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -821,10 +938,10 @@ func (m *MsgClaimResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgClaimResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgClaimDailyResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgClaimResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgClaimDailyResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -909,6 +1026,38 @@ func (m *MsgClaimEarly) Unmarshal(dAtA []byte) error { } m.Claimer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AirdropId", 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.AirdropId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -1041,6 +1190,70 @@ func (m *MsgClaimAndStake) Unmarshal(dAtA []byte) error { } m.Claimer = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AirdropId", 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.AirdropId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddress", 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.ValidatorAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:])