ca9448bc11
The actual actors version is v2, not v1. Using Version1 internally was really confusing.
59 lines
1.9 KiB
Go
59 lines
1.9 KiB
Go
package reward
|
|
|
|
import (
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
|
"github.com/ipfs/go-cid"
|
|
"golang.org/x/xerrors"
|
|
|
|
"github.com/filecoin-project/go-state-types/cbor"
|
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
|
|
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
)
|
|
|
|
func init() {
|
|
builtin.RegisterActorState(builtin0.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
return load0(store, root)
|
|
})
|
|
builtin.RegisterActorState(builtin2.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
return load2(store, root)
|
|
})
|
|
}
|
|
|
|
var Address = builtin0.RewardActorAddr
|
|
|
|
func Load(store adt.Store, act *types.Actor) (st State, err error) {
|
|
switch act.Code {
|
|
case builtin0.RewardActorCodeID:
|
|
return load0(store, act.Head)
|
|
case builtin2.RewardActorCodeID:
|
|
return load2(store, act.Head)
|
|
}
|
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
|
}
|
|
|
|
type State interface {
|
|
cbor.Marshaler
|
|
|
|
ThisEpochBaselinePower() (abi.StoragePower, error)
|
|
ThisEpochReward() (abi.StoragePower, error)
|
|
ThisEpochRewardSmoothed() (builtin.FilterEstimate, error)
|
|
|
|
EffectiveBaselinePower() (abi.StoragePower, error)
|
|
EffectiveNetworkTime() (abi.ChainEpoch, error)
|
|
|
|
TotalStoragePowerReward() (abi.TokenAmount, error)
|
|
|
|
CumsumBaseline() (abi.StoragePower, error)
|
|
CumsumRealized() (abi.StoragePower, error)
|
|
|
|
InitialPledgeForPower(abi.StoragePower, abi.TokenAmount, *builtin.FilterEstimate, abi.TokenAmount) (abi.TokenAmount, error)
|
|
PreCommitDepositForPower(builtin.FilterEstimate, abi.StoragePower) (abi.TokenAmount, error)
|
|
}
|
|
|
|
type AwardBlockRewardParams = reward0.AwardBlockRewardParams
|