Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove tf bank hooks from v16.x #5614

Merged
merged 1 commit into from Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 0 additions & 5 deletions app/keepers/keepers.go
Expand Up @@ -676,11 +676,6 @@ func (appKeepers *AppKeepers) SetupHooks() {
// e.g. *app.StakingKeeper doesn't appear

// Recall that SetHooks is a mutative call.
appKeepers.BankKeeper.SetHooks(
banktypes.NewMultiBankHooks(
appKeepers.TokenFactoryKeeper.Hooks(),
),
)

appKeepers.StakingKeeper.SetHooks(
stakingtypes.NewMultiStakingHooks(
Expand Down
19 changes: 0 additions & 19 deletions proto/osmosis/tokenfactory/v1beta1/query.proto
Expand Up @@ -32,14 +32,6 @@ service Query {
option (google.api.http).get =
"/osmosis/tokenfactory/v1beta1/denoms_from_creator/{creator}";
}

// BeforeSendHookAddress defines a gRPC query method for
// getting the address registered for the before send hook.
rpc BeforeSendHookAddress(QueryBeforeSendHookAddressRequest)
returns (QueryBeforeSendHookAddressResponse) {
option (google.api.http).get =
"/osmosis/tokenfactory/v1beta1/denoms/{denom}/before_send_hook";
}
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
Expand Down Expand Up @@ -77,14 +69,3 @@ message QueryDenomsFromCreatorRequest {
message QueryDenomsFromCreatorResponse {
repeated string denoms = 1 [ (gogoproto.moretags) = "yaml:\"denoms\"" ];
}

message QueryBeforeSendHookAddressRequest {
string denom = 1 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
}

// QueryBeforeSendHookAddressResponse defines the response structure for the
// DenomBeforeSendHook gRPC query.
message QueryBeforeSendHookAddressResponse {
string cosmwasm_address = 1
[ (gogoproto.moretags) = "yaml:\"cosmwasm_address\"" ];
}
27 changes: 13 additions & 14 deletions proto/osmosis/tokenfactory/v1beta1/tx.proto
Expand Up @@ -16,8 +16,6 @@ service Msg {
rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse);
rpc SetDenomMetadata(MsgSetDenomMetadata)
returns (MsgSetDenomMetadataResponse);
rpc SetBeforeSendHook(MsgSetBeforeSendHook)
returns (MsgSetBeforeSendHookResponse);
rpc ForceTransfer(MsgForceTransfer) returns (MsgForceTransferResponse);
}

Expand Down Expand Up @@ -91,18 +89,19 @@ message MsgChangeAdmin {
// MsgChangeAdmin message.
message MsgChangeAdminResponse {}

// MsgSetBeforeSendHook is the sdk.Msg type for allowing an admin account to
// assign a CosmWasm contract to call with a BeforeSend hook
message MsgSetBeforeSendHook {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
string cosmwasm_address = 3
[ (gogoproto.moretags) = "yaml:\"cosmwasm_address\"" ];
}

// MsgSetBeforeSendHookResponse defines the response structure for an executed
// MsgSetBeforeSendHook message.
message MsgSetBeforeSendHookResponse {}
// // MsgSetBeforeSendHook is the sdk.Msg type for allowing an admin account to
// // assign a CosmWasm contract to call with a BeforeSend hook
// message MsgSetBeforeSendHook {
// string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
// string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ];
// string cosmwasm_address = 3
// [ (gogoproto.moretags) = "yaml:\"cosmwasm_address\"" ];
// }

// // MsgSetBeforeSendHookResponse defines the response structure for an
// executed
// // MsgSetBeforeSendHook message.
// message MsgSetBeforeSendHookResponse {}

// MsgSetDenomMetadata is the sdk.Msg type for allowing an admin account to set
// the denom's bank metadata
Expand Down
31 changes: 0 additions & 31 deletions x/tokenfactory/client/cli/query.go
Expand Up @@ -4,8 +4,6 @@ import (

// "strings"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

// "github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -47,32 +45,3 @@ func GetCmdDenomsFromCreator() (*osmocli.QueryDescriptor, *types.QueryDenomsFrom
{{.CommandPrefix}} <address>`,
}, &types.QueryDenomsFromCreatorRequest{}
}

// GetCmdDenomAuthorityMetadata returns the authority metadata for a queried denom
func GetCmdDenomBeforeSendHook() *cobra.Command {
cmd := &cobra.Command{
Use: "denom-before-send-hook [denom] [flags]",
Short: "Get the BeforeSend hook for a specific denom",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientQueryContext(cmd)
if err != nil {
return err
}
queryClient := types.NewQueryClient(clientCtx)

res, err := queryClient.BeforeSendHookAddress(cmd.Context(), &types.QueryBeforeSendHookAddressRequest{
Denom: args[0],
})
if err != nil {
return err
}

return clientCtx.PrintProto(res)
},
}

flags.AddQueryFlagsToCmd(cmd)

return cmd
}
33 changes: 1 addition & 32 deletions x/tokenfactory/client/cli/tx.go
@@ -1,9 +1,6 @@
package cli

import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"

// "github.com/cosmos/cosmos-sdk/client/flags"
Expand All @@ -20,7 +17,7 @@ func GetTxCmd() *cobra.Command {
NewBurnCmd(),
// NewForceTransferCmd(),
NewChangeAdminCmd(),
NewSetBeforeSendHookCmd(),
// NewSetBeforeSendHookCmd(),
)

return cmd
Expand Down Expand Up @@ -53,31 +50,3 @@ func NewChangeAdminCmd() *cobra.Command {
Short: "Changes the admin address for a factory-created denom. Must have admin authority to do so.",
})
}

// NewChangeAdminCmd broadcast MsgChangeAdmin
func NewSetBeforeSendHookCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "set-beforesend-hook [denom] [cosmwasm-address] [flags]",
Short: "Set a cosmwasm contract to be the beforesend hook for a factory-created denom. Must have admin authority to do so.",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()).WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever)

msg := types.NewMsgSetBeforeSendHook(
clientCtx.GetFromAddress().String(),
args[0],
args[1],
)

return tx.GenerateOrBroadcastTxWithFactory(clientCtx, txf, msg)
},
}

flags.AddTxFlagsToCmd(cmd)
return cmd
}
133 changes: 0 additions & 133 deletions x/tokenfactory/keeper/before_send.go

This file was deleted.