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

fix:cli:make the evm invoke command work again #10031

Merged
merged 1 commit into from
Jan 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cli/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ var EvmInvokeCmd = &cli.Command{
defer closer()
ctx := ReqContext(cctx)

if argc := cctx.Args().Len(); argc < 2 || argc > 3 {
return xerrors.Errorf("must pass the address, entry point and (optionally) input data")
if argc := cctx.Args().Len(); argc != 2 {
return xerrors.Errorf("must pass the address and calldata")
}

addr, err := address.NewFromString(cctx.Args().Get(0))
Expand All @@ -355,7 +355,7 @@ var EvmInvokeCmd = &cli.Command{
}

var calldata []byte
calldata, err = hex.DecodeString(cctx.Args().Get(2))
calldata, err = hex.DecodeString(cctx.Args().Get(1))
if err != nil {
return xerrors.Errorf("decoding hex input data: %w", err)
}
Expand Down Expand Up @@ -388,7 +388,7 @@ var EvmInvokeCmd = &cli.Command{
To: addr,
From: fromAddr,
Value: val,
Method: abi.MethodNum(2),
Method: builtintypes.MethodsEVM.InvokeContract,
Params: calldata,
}

Expand Down