lotus/chain/gen/genesis/t02_reward.go

33 lines
798 B
Go
Raw Normal View History

2020-02-11 20:48:03 +00:00
package genesis
import (
"context"
2020-09-07 03:49:10 +00:00
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/actors/builtin"
2020-09-17 06:42:39 +00:00
v0reward "github.com/filecoin-project/specs-actors/actors/builtin/reward"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types"
bstore "github.com/filecoin-project/lotus/lib/blockstore"
)
func SetupRewardActor(bs bstore.Blockstore, qaPower big.Int) (*types.Actor, error) {
cst := cbor.NewCborStore(bs)
2020-09-17 06:42:39 +00:00
st := v0reward.ConstructState(qaPower)
hcid, err := cst.Put(context.TODO(), st)
if err != nil {
return nil, err
}
return &types.Actor{
Code: builtin.RewardActorCodeID,
2020-03-07 01:33:24 +00:00
Balance: types.BigInt{Int: build.InitialRewardBalance},
Head: hcid,
}, nil
}