lotus/chain/gen/genesis/f02_reward.go
2021-01-29 20:01:00 +00:00

33 lines
792 B
Go

package genesis
import (
"context"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/actors/builtin"
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
cbor "github.com/ipfs/go-ipld-cbor"
bstore "github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types"
)
func SetupRewardActor(bs bstore.Blockstore, qaPower big.Int) (*types.Actor, error) {
cst := cbor.NewCborStore(bs)
st := reward0.ConstructState(qaPower)
hcid, err := cst.Put(context.TODO(), st)
if err != nil {
return nil, err
}
return &types.Actor{
Code: builtin.RewardActorCodeID,
Balance: types.BigInt{Int: build.InitialRewardBalance},
Head: hcid,
}, nil
}