Skip to content

Commit

Permalink
delete the code related to setting ExoCoreLzAppAddress to fix the bug…
Browse files Browse the repository at this point in the history
… when set parameter
  • Loading branch information
TimmyExogenous committed Mar 4, 2024
1 parent a524619 commit 0826b03
Show file tree
Hide file tree
Showing 23 changed files with 9 additions and 2,416 deletions.
6 changes: 0 additions & 6 deletions precompiles/withdraw/withdraw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ func (s *PrecompileTestSuite) TestRunWithdrawThroughClientChain() {
err := s.app.DepositKeeper.SetParams(s.ctx, depositModuleParam)
s.Require().NoError(err)
depositAsset(s.address.Bytes(), sdkmath.NewIntFromBigInt(depositAmount))
withdrawModuleParam := &depositparams.Params{
ExoCoreLzAppAddress: s.address.String(),
ExoCoreLzAppEventTopic: exoCoreLzAppEventTopic,
}
err = s.app.WithdrawKeeper.SetParams(s.ctx, withdrawModuleParam)
s.Require().NoError(err)
return commonMalleate()
},
returnBytes: successRet,
Expand Down
24 changes: 0 additions & 24 deletions proto/exocore/withdraw/query.proto

This file was deleted.

36 changes: 0 additions & 36 deletions proto/exocore/withdraw/tx.proto

This file was deleted.

2 changes: 1 addition & 1 deletion x/withdraw/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func GetQueryCmd(string) *cobra.Command {
RunE: client.ValidateCmd,
}

cmd.AddCommand(CmdQueryParams())
cmd.AddCommand()
// this line is used by starport scaffolding # 1

return cmd
Expand Down
36 changes: 0 additions & 36 deletions x/withdraw/client/cli/query_params.go

This file was deleted.

48 changes: 4 additions & 44 deletions x/withdraw/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,23 @@ package cli

import (
"fmt"
"github.com/ExocoreNetwork/exocore/x/withdraw/types"

"github.com/spf13/cobra"

"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/client/flags"
paramstypes "github.com/ExocoreNetwork/exocore/x/deposit/types"
"github.com/ExocoreNetwork/exocore/x/withdraw/types"
)

// GetTxCmd returns the transaction commands for this module
func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: paramstypes.ModuleName,
Short: fmt.Sprintf("%s transactions subcommands", paramstypes.ModuleName),
Use: types.ModuleName,
Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: client.ValidateCmd,
}

cmd.AddCommand(
UpdateParams(),
)

return cmd
}

// UpdateParams todo: it should be a gov proposal command in future.
func UpdateParams() *cobra.Command {
cmd := &cobra.Command{
Use: "UpdateParams ExoCoreLZAppAddr ExoCoreLzAppEventTopic",
Short: "set ExoCoreLZAppAddr and ExoCoreLzAppEventTopic params to withdraw module",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
cliCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}

sender := cliCtx.GetFromAddress()
msg := &types.MsgUpdateParams{
Authority: sender.String(),
Params: paramstypes.Params{
ExoCoreLzAppAddress: args[0],
ExoCoreLzAppEventTopic: args[1],
},
}

if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(cliCtx, cmd.Flags(), msg)
},
}

flags.AddTxFlagsToCmd(cmd)
cmd.AddCommand()
return cmd
}
21 changes: 0 additions & 21 deletions x/withdraw/keeper/msg_server.go

This file was deleted.

18 changes: 0 additions & 18 deletions x/withdraw/keeper/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,3 @@ func (k Keeper) GetParams(ctx sdk.Context) (*paramstypes.Params, error) {
// Uify the way to obtain Params from deposit keeper
return k.depositKeeper.GetParams(ctx)
}

// SetParams set the params
func (k Keeper) SetParams(ctx sdk.Context, params *paramstypes.Params) error {
// // check if addr is evm address
// if !common.IsHexAddress(params.ExoCoreLzAppAddress) {
// return types.ErrInvalidEvmAddressFormat
// }
// if len(common.FromHex(params.ExoCoreLzAppEventTopic)) != common.HashLength {
// return types.ErrInvalidLzUaTopicIDLength
// }
// params.ExoCoreLzAppAddress = strings.ToLower(params.ExoCoreLzAppAddress)
// params.ExoCoreLzAppEventTopic = strings.ToLower(params.ExoCoreLzAppEventTopic)
// store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixParams)
// bz := k.cdc.MustMarshal(params)
// store.Set(types.ParamsKey, bz)
// return nil
return k.depositKeeper.SetParams(ctx, params)
}
18 changes: 0 additions & 18 deletions x/withdraw/keeper/params_test.go

This file was deleted.

7 changes: 0 additions & 7 deletions x/withdraw/keeper/query.go

This file was deleted.

19 changes: 0 additions & 19 deletions x/withdraw/keeper/query_params.go

This file was deleted.

34 changes: 4 additions & 30 deletions x/withdraw/module.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package withdraw

import (
"context"
"encoding/json"
"fmt"

// this line is used by starport scaffolding # 1

"github.com/grpc-ecosystem/grpc-gateway/runtime"
Expand Down Expand Up @@ -49,35 +45,13 @@ func (AppModuleBasic) Name() string {
}

// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
types.RegisterLegacyAminoCodec(cdc)
}
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}

// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message
func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {
types.RegisterInterfaces(reg)
}

// DefaultGenesis returns a default GenesisState for the module, marshaled to json.RawMessage. The default GenesisState need to be defined by the module developer and is primarily used for testing
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesis())
}

// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var genState types.GenesisState
if err := cdc.UnmarshalJSON(bz, &genState); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
}
return genState.Validate()
}
func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) {}

// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {
if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(clientCtx)); err != nil {
panic(err)
}
}
func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {}

// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to generate new transactions containing messages defined in the module
func (a AppModuleBasic) GetTxCmd() *cobra.Command {
Expand Down Expand Up @@ -113,7 +87,7 @@ func NewAppModule(
// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries
func (am AppModule) RegisterServices(cfg module.Configurator) {
// types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
//types.RegisterQueryServer(cfg.QueryServer(), am.keeper)
}

// RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted)
Expand Down
50 changes: 0 additions & 50 deletions x/withdraw/types/codec.go

This file was deleted.

Loading

0 comments on commit 0826b03

Please sign in to comment.