8b5da86727
Introduce nv21 skeleton for local testing: - Use local go-state-types with actor_version_checklist changes: https://github.com/filecoin-project/go-state-types/blob/master/actors_version_checklist.md - Imports mock v12-actors bundle - Define upgrade heights - Generate adapters - Add upgrade schedule and migration - Add actorstype to the NewActorRegistry in /chain/consensus/computestate.go - Add upgrade field to api/types.go/ForkUpgradeParams - Add upgrade to node/impl/full/state.go - Add network version to chain/state/statetree.go - make jen - make docsgen-cli
78 lines
2.1 KiB
Go
Generated
78 lines
2.1 KiB
Go
Generated
package multisig
|
|
|
|
import (
|
|
"golang.org/x/xerrors"
|
|
|
|
"github.com/filecoin-project/go-address"
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
actorstypes "github.com/filecoin-project/go-state-types/actors"
|
|
builtintypes "github.com/filecoin-project/go-state-types/builtin"
|
|
multisig11 "github.com/filecoin-project/go-state-types/builtin/v11/multisig"
|
|
init12 "github.com/filecoin-project/go-state-types/builtin/v12/init"
|
|
"github.com/filecoin-project/go-state-types/manifest"
|
|
|
|
"github.com/filecoin-project/lotus/chain/actors"
|
|
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
)
|
|
|
|
type message11 struct{ message0 }
|
|
|
|
func (m message11) Create(
|
|
signers []address.Address, threshold uint64,
|
|
unlockStart, unlockDuration abi.ChainEpoch,
|
|
initialAmount abi.TokenAmount,
|
|
) (*types.Message, error) {
|
|
|
|
lenAddrs := uint64(len(signers))
|
|
|
|
if lenAddrs < threshold {
|
|
return nil, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")
|
|
}
|
|
|
|
if threshold == 0 {
|
|
threshold = lenAddrs
|
|
}
|
|
|
|
if m.from == address.Undef {
|
|
return nil, xerrors.Errorf("must provide source address")
|
|
}
|
|
|
|
// Set up constructor parameters for multisig
|
|
msigParams := &multisig11.ConstructorParams{
|
|
Signers: signers,
|
|
NumApprovalsThreshold: threshold,
|
|
UnlockDuration: unlockDuration,
|
|
StartEpoch: unlockStart,
|
|
}
|
|
|
|
enc, actErr := actors.SerializeParams(msigParams)
|
|
if actErr != nil {
|
|
return nil, actErr
|
|
}
|
|
|
|
code, ok := actors.GetActorCodeID(actorstypes.Version11, manifest.MultisigKey)
|
|
if !ok {
|
|
return nil, xerrors.Errorf("failed to get multisig code ID")
|
|
}
|
|
|
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
|
execParams := &init12.ExecParams{
|
|
CodeCID: code,
|
|
ConstructorParams: enc,
|
|
}
|
|
|
|
enc, actErr = actors.SerializeParams(execParams)
|
|
if actErr != nil {
|
|
return nil, actErr
|
|
}
|
|
|
|
return &types.Message{
|
|
To: init_.Address,
|
|
From: m.from,
|
|
Method: builtintypes.MethodsInit.Exec,
|
|
Params: enc,
|
|
Value: initialAmount,
|
|
}, nil
|
|
}
|