2021-04-27 18:48:32 +00:00
|
|
|
package cron
|
|
|
|
|
|
|
|
import (
|
2021-05-15 01:11:23 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/actors"
|
|
|
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
|
|
|
"golang.org/x/xerrors"
|
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
{{range .versions}}
|
|
|
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
|
|
|
{{end}}
|
2021-04-27 18:48:32 +00:00
|
|
|
)
|
|
|
|
|
2021-05-15 01:11:23 +00:00
|
|
|
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) {
|
2022-04-04 11:23:13 +00:00
|
|
|
if c, ok := actors.GetActorCodeID(av, "cron"); ok {
|
|
|
|
return c, nil
|
|
|
|
}
|
|
|
|
|
2021-05-15 01:11:23 +00:00
|
|
|
switch av {
|
|
|
|
{{range .versions}}
|
|
|
|
case actors.Version{{.}}:
|
|
|
|
return builtin{{.}}.CronActorCodeID, nil
|
|
|
|
{{end}}
|
|
|
|
}
|
|
|
|
|
|
|
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
|
|
}
|
|
|
|
|
2021-04-27 18:48:32 +00:00
|
|
|
var (
|
|
|
|
Address = builtin{{.latestVersion}}.CronActorAddr
|
|
|
|
Methods = builtin{{.latestVersion}}.MethodsCron
|
|
|
|
)
|
2021-05-15 01:11:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
type State interface {
|
|
|
|
GetState() interface{}
|
|
|
|
}
|