add --hex option to create-evm-actor

This commit is contained in:
vyzo 2022-10-04 10:59:48 +03:00
parent 61de2f4a4a
commit b9ed239cf4

View File

@ -1522,6 +1522,10 @@ var ChainExecEVMCmd = &cli.Command{
Name: "from",
Usage: "optionally specify the account to use for sending the exec message",
},
&cli.BoolFlag{
Name: "hex",
Usage: "use when input contract is in hex",
},
},
Action: func(cctx *cli.Context) error {
afmt := NewAppFmt(cctx.App)
@ -1541,6 +1545,12 @@ var ChainExecEVMCmd = &cli.Command{
if err != nil {
return xerrors.Errorf("failed to read contract: %w", err)
}
if cctx.Bool("hex") {
contract, err = hex.DecodeString(string(contract))
if err != nil {
return xerrors.Errorf("failed to decode contract: %w", err)
}
}
constructorParams, err := actors.SerializeParams(&evm.ConstructorParams{
Bytecode: contract,