46 lines
962 B
Plaintext
46 lines
962 B
Plaintext
package system
|
|
|
|
import (
|
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
|
"github.com/filecoin-project/lotus/chain/actors"
|
|
"golang.org/x/xerrors"
|
|
"github.com/ipfs/go-cid"
|
|
|
|
{{range .versions}}
|
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
|
{{end}}
|
|
)
|
|
|
|
var (
|
|
Address = builtin{{.latestVersion}}.SystemActorAddr
|
|
)
|
|
|
|
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|
switch av {
|
|
{{range .versions}}
|
|
case actors.Version{{.}}:
|
|
return make{{.}}(store)
|
|
{{end}}
|
|
}
|
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
|
}
|
|
|
|
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
if c, ok := actors.GetActorCodeID(av, "system"); ok {
|
|
return c, nil
|
|
}
|
|
|
|
switch av {
|
|
{{range .versions}}
|
|
case actors.Version{{.}}:
|
|
return builtin{{.}}.SystemActorCodeID, nil
|
|
{{end}}
|
|
}
|
|
|
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
}
|
|
|
|
type State interface {
|
|
GetState() interface{}
|
|
}
|