lotus/chain/gen/genesis/f03_cron.go

30 lines
665 B
Go
Raw Normal View History

2020-02-11 20:48:03 +00:00
package genesis
import (
"context"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/cron"
2020-02-11 20:48:03 +00:00
cbor "github.com/ipfs/go-ipld-cbor"
bstore "github.com/filecoin-project/lotus/blockstore"
2020-02-11 20:48:03 +00:00
"github.com/filecoin-project/lotus/chain/types"
)
func SetupCronActor(bs bstore.Blockstore) (*types.Actor, error) {
2020-02-11 20:48:03 +00:00
cst := cbor.NewCborStore(bs)
cas := cron.ConstructState(cron.BuiltInEntries())
2020-02-11 20:48:03 +00:00
stcid, err := cst.Put(context.TODO(), cas)
2020-02-11 20:48:03 +00:00
if err != nil {
return nil, err
}
return &types.Actor{
Code: builtin.CronActorCodeID,
Head: stcid,
Nonce: 0,
Balance: types.NewInt(0),
}, nil
2020-02-11 20:48:03 +00:00
}