Skip to content

Commit 550b137

Browse files
committed
fix: multisig support call invoke contract
1 parent 2e75f3b commit 550b137

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

cli/multisig.go

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/filecoin-project/go-address"
2020
"github.com/filecoin-project/go-state-types/abi"
2121
"github.com/filecoin-project/go-state-types/big"
22+
builtintypes "github.com/filecoin-project/go-state-types/builtin"
2223
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
2324
msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
2425

@@ -410,7 +411,16 @@ var msigProposeCmd = &cli.Command{
410411
if err != nil {
411412
return err
412413
}
413-
params = p
414+
415+
if abi.MethodNum(method) == builtintypes.MethodsEVM.InvokeContract {
416+
var buffer bytes.Buffer
417+
if err := cbg.WriteByteArray(&buffer, p); err != nil {
418+
return xerrors.Errorf("failed to encode evm params as cbor: %w", err)
419+
}
420+
params = buffer.Bytes()
421+
} else {
422+
params = p
423+
}
414424
}
415425

416426
var from address.Address
@@ -582,7 +592,15 @@ var msigApproveCmd = &cli.Command{
582592
if err != nil {
583593
return err
584594
}
585-
params = p
595+
if abi.MethodNum(method) == builtintypes.MethodsEVM.InvokeContract {
596+
var buffer bytes.Buffer
597+
if err := cbg.WriteByteArray(&buffer, p); err != nil {
598+
return xerrors.Errorf("failed to encode evm params as cbor: %w", err)
599+
}
600+
params = buffer.Bytes()
601+
} else {
602+
params = p
603+
}
586604
}
587605

588606
proto, err := api.MsigApproveTxnHash(ctx, msig, txid, proposer, dest, types.BigInt(value), from, method, params)
@@ -707,7 +725,16 @@ var msigCancelCmd = &cli.Command{
707725
if err != nil {
708726
return err
709727
}
710-
params = p
728+
729+
if abi.MethodNum(method) == builtintypes.MethodsEVM.InvokeContract {
730+
var buffer bytes.Buffer
731+
if err := cbg.WriteByteArray(&buffer, p); err != nil {
732+
return xerrors.Errorf("failed to encode evm params as cbor: %w", err)
733+
}
734+
params = buffer.Bytes()
735+
} else {
736+
params = p
737+
}
711738
}
712739

713740
proto, err := api.MsigCancelTxnHash(ctx, msig, txid, dest, types.BigInt(value), from, method, params)

0 commit comments

Comments
 (0)