lotus/chain/gen/genesis/t02_reward.go
Jakub Sztandera bb33994219
Make reward actor state in genesis more realistic
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
2020-07-20 17:59:05 +02:00

32 lines
781 B
Go

package genesis
import (
"context"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/reward"
bstore "github.com/ipfs/go-ipfs-blockstore"
cbor "github.com/ipfs/go-ipld-cbor"
)
func SetupRewardActor(bs bstore.Blockstore, qaPower big.Int) (*types.Actor, error) {
cst := cbor.NewCborStore(bs)
st := reward.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
}