Skip to content

Commit c2be47a

Browse files
committed
remove testing command
1 parent 374a398 commit c2be47a

File tree

6 files changed

+31
-1695
lines changed

6 files changed

+31
-1695
lines changed

proto/restake/v1beta1/tx.proto

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,13 @@ package restake.v1beta1;
44
option go_package = "github.com/bandprotocol/chain/v2/x/restake/types";
55

66
import "amino/amino.proto";
7-
import "cosmos/base/v1beta1/coin.proto";
87
import "cosmos/msg/v1/msg.proto";
98
import "cosmos_proto/cosmos.proto";
10-
import "gogoproto/gogo.proto";
119

1210
// Service definition for Msg which handles restake related messages.
1311
service Msg {
1412
// RPC method for claiming rewards.
1513
rpc ClaimRewards(MsgClaimRewards) returns (MsgClaimRewardsResponse);
16-
17-
//////////////////////////////////////////
18-
// Methods below are for testing only.
19-
//////////////////////////////////////////
20-
21-
// RPC method for locking powers.
22-
rpc LockPower(MsgLockPower) returns (MsgLockPowerResponse);
23-
24-
// RPC method for adding rewards.
25-
rpc AddRewards(MsgAddRewards) returns (MsgAddRewardsResponse);
26-
27-
// RPC method for deactivating a key.
28-
rpc DeactivateKey(MsgDeactivateKey) returns (MsgDeactivateKeyResponse);
2914
}
3015

3116
// MsgClaimRewards is the request message type for claiming rewards.
@@ -42,62 +27,3 @@ message MsgClaimRewards {
4227

4328
// MsgClaimRewardsResponse is the response message type for claiming rewards.
4429
message MsgClaimRewardsResponse {}
45-
46-
// MsgLockPower is the request message type for locking tokens.
47-
message MsgLockPower {
48-
option (cosmos.msg.v1.signer) = "locker_address";
49-
option (amino.name) = "restake/MsgLockPower";
50-
51-
// LockerAddress is the address will be locked power.
52-
string locker_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
53-
54-
// Key is the key that power will be locked to.
55-
string key = 2;
56-
57-
// Amount is the power amount that will be locked.
58-
string amount = 3 [
59-
(cosmos_proto.scalar) = "cosmos.Int",
60-
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
61-
(gogoproto.nullable) = false
62-
];
63-
}
64-
65-
// MsgLockPowerResponse is the response message type for locking power.
66-
message MsgLockPowerResponse {}
67-
68-
// MsgAddRewards is the request message type for adding rewards.
69-
message MsgAddRewards {
70-
option (cosmos.msg.v1.signer) = "sender";
71-
option (amino.name) = "restake/MsgAddRewards";
72-
73-
// Sender is the address that want to send rewards.
74-
string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
75-
76-
// Key is the key of pool that reward will be sent to.
77-
string key = 2;
78-
79-
// Rewards is a list of rewards that will send to module.
80-
repeated cosmos.base.v1beta1.Coin rewards = 3 [
81-
(gogoproto.nullable) = false,
82-
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins",
83-
(gogoproto.jsontag) = "min_deposit,omitempty"
84-
];
85-
}
86-
87-
// MsgAddRewardsResponse is the response message type for adding rewards.
88-
message MsgAddRewardsResponse {}
89-
90-
// MsgDeactivateKey is the request message type for deactivating a key.
91-
message MsgDeactivateKey {
92-
option (cosmos.msg.v1.signer) = "sender";
93-
option (amino.name) = "restake/MsgDeactivateKey";
94-
95-
// Sender is the sender of the message.
96-
string sender = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
97-
98-
// Key is the key that will be deactivated.
99-
string key = 2;
100-
}
101-
102-
// MsgDeactivateKeyResponse is the response message type for deactivating a key.
103-
message MsgDeactivateKeyResponse {}

scripts/restake/test.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

x/restake/client/cli/tx.go

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"fmt"
66

7-
sdkmath "cosmossdk.io/math"
87
"github.com/cosmos/cosmos-sdk/client"
98
"github.com/cosmos/cosmos-sdk/client/flags"
109
"github.com/cosmos/cosmos-sdk/client/tx"
@@ -27,9 +26,6 @@ func GetTxCmd() *cobra.Command {
2726

2827
txCmd.AddCommand(
2928
GetTxCmdClaimRewards(),
30-
GetTxCmdAddRewards(),
31-
GetTxCmdLockPower(),
32-
GetTxCmdDeactivateKey(),
3329
)
3430

3531
return txCmd
@@ -112,97 +108,3 @@ func GetTxCmdClaimRewards() *cobra.Command {
112108

113109
return cmd
114110
}
115-
116-
// GetTxCmdLockPower creates a CLI command for locking power
117-
func GetTxCmdLockPower() *cobra.Command {
118-
cmd := &cobra.Command{
119-
Use: "lock-power [key] [amount]",
120-
Short: "lock power to the key",
121-
Args: cobra.ExactArgs(2),
122-
RunE: func(cmd *cobra.Command, args []string) error {
123-
clientCtx, err := client.GetClientTxContext(cmd)
124-
if err != nil {
125-
return err
126-
}
127-
128-
key := args[0]
129-
amount, ok := sdkmath.NewIntFromString(args[1])
130-
if !ok {
131-
return fmt.Errorf("invalid amount")
132-
}
133-
134-
msg := types.NewMsgLockPower(
135-
clientCtx.GetFromAddress(),
136-
key,
137-
amount,
138-
)
139-
140-
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
141-
},
142-
}
143-
144-
flags.AddTxFlagsToCmd(cmd)
145-
146-
return cmd
147-
}
148-
149-
// GetTxCmdAddRewards creates a CLI command for adding rewards
150-
func GetTxCmdAddRewards() *cobra.Command {
151-
cmd := &cobra.Command{
152-
Use: "add-rewards [key] [coins]",
153-
Short: "Add rewards to the key",
154-
Args: cobra.ExactArgs(2),
155-
RunE: func(cmd *cobra.Command, args []string) error {
156-
clientCtx, err := client.GetClientTxContext(cmd)
157-
if err != nil {
158-
return err
159-
}
160-
161-
key := args[0]
162-
coins, err := sdk.ParseCoinsNormalized(args[1])
163-
if err != nil {
164-
return err
165-
}
166-
167-
msg := types.NewMsgAddRewards(
168-
clientCtx.GetFromAddress(),
169-
key,
170-
coins,
171-
)
172-
173-
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
174-
},
175-
}
176-
177-
flags.AddTxFlagsToCmd(cmd)
178-
179-
return cmd
180-
}
181-
182-
// GetTxCmdDeactivateKey creates a CLI command for deactivating key
183-
func GetTxCmdDeactivateKey() *cobra.Command {
184-
cmd := &cobra.Command{
185-
Use: "deactivate [key]",
186-
Short: "Deactivate key",
187-
Args: cobra.ExactArgs(1),
188-
RunE: func(cmd *cobra.Command, args []string) error {
189-
clientCtx, err := client.GetClientTxContext(cmd)
190-
if err != nil {
191-
return err
192-
}
193-
194-
key := args[0]
195-
196-
msg := types.NewMsgDeactivateKey(
197-
clientCtx.GetFromAddress(),
198-
key,
199-
)
200-
201-
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
202-
},
203-
}
204-
205-
flags.AddTxFlagsToCmd(cmd)
206-
207-
return cmd
208-
}

x/restake/keeper/msg_server.go

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -74,55 +74,3 @@ func (k msgServer) ClaimRewards(
7474

7575
return &types.MsgClaimRewardsResponse{}, nil
7676
}
77-
78-
func (k msgServer) LockPower(
79-
goCtx context.Context,
80-
msg *types.MsgLockPower,
81-
) (*types.MsgLockPowerResponse, error) {
82-
ctx := sdk.UnwrapSDKContext(goCtx)
83-
84-
address, err := sdk.AccAddressFromBech32(msg.LockerAddress)
85-
if err != nil {
86-
return nil, err
87-
}
88-
89-
err = k.SetLockedPower(ctx, address, msg.Key, msg.Amount)
90-
if err != nil {
91-
return nil, err
92-
}
93-
94-
return &types.MsgLockPowerResponse{}, nil
95-
}
96-
97-
func (k msgServer) AddRewards(
98-
goCtx context.Context,
99-
msg *types.MsgAddRewards,
100-
) (*types.MsgAddRewardsResponse, error) {
101-
ctx := sdk.UnwrapSDKContext(goCtx)
102-
103-
sender, err := sdk.AccAddressFromBech32(msg.Sender)
104-
if err != nil {
105-
return nil, err
106-
}
107-
108-
err = k.Keeper.AddRewards(ctx, sender, msg.Key, msg.Rewards)
109-
if err != nil {
110-
return nil, err
111-
}
112-
113-
return &types.MsgAddRewardsResponse{}, nil
114-
}
115-
116-
func (k msgServer) DeactivateKey(
117-
goCtx context.Context,
118-
msg *types.MsgDeactivateKey,
119-
) (*types.MsgDeactivateKeyResponse, error) {
120-
ctx := sdk.UnwrapSDKContext(goCtx)
121-
122-
err := k.Keeper.DeactivateKey(ctx, msg.Key)
123-
if err != nil {
124-
return nil, err
125-
}
126-
127-
return &types.MsgDeactivateKeyResponse{}, nil
128-
}

0 commit comments

Comments
 (0)