2021-04-27 18:48:32 +00:00
|
|
|
package verifreg
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
"golang.org/x/xerrors"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/go-address"
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/go-state-types/cbor"
|
|
|
|
{{range .versions}}
|
2021-04-30 15:51:24 +00:00
|
|
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
|
|
|
{{end}}
|
2021-04-27 18:48:32 +00:00
|
|
|
|
|
|
|
"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() {
|
2021-04-30 15:51:24 +00:00
|
|
|
{{range .versions}}
|
|
|
|
builtin.RegisterActorState(builtin{{.}}.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
2021-04-27 18:48:32 +00:00
|
|
|
return load{{.}}(store, root)
|
|
|
|
})
|
2021-04-30 15:51:24 +00:00
|
|
|
{{end}}
|
|
|
|
}
|
2021-04-27 18:48:32 +00:00
|
|
|
|
|
|
|
var (
|
|
|
|
Address = builtin{{.latestVersion}}.VerifiedRegistryActorAddr
|
|
|
|
Methods = builtin{{.latestVersion}}.MethodsVerifiedRegistry
|
|
|
|
)
|
|
|
|
|
|
|
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
|
|
|
switch act.Code {
|
2021-04-30 15:51:24 +00:00
|
|
|
{{range .versions}}
|
|
|
|
case builtin{{.}}.VerifiedRegistryActorCodeID:
|
2021-04-27 18:48:32 +00:00
|
|
|
return load{{.}}(store, act.Head)
|
2021-04-30 15:51:24 +00:00
|
|
|
{{end}}
|
|
|
|
}
|
2021-04-27 18:48:32 +00:00
|
|
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
|
|
|
}
|
|
|
|
|
|
|
|
type State interface {
|
|
|
|
cbor.Marshaler
|
|
|
|
|
|
|
|
RootKey() (address.Address, error)
|
|
|
|
VerifiedClientDataCap(address.Address) (bool, abi.StoragePower, error)
|
|
|
|
VerifierDataCap(address.Address) (bool, abi.StoragePower, error)
|
|
|
|
ForEachVerifier(func(addr address.Address, dcap abi.StoragePower) error) error
|
|
|
|
ForEachClient(func(addr address.Address, dcap abi.StoragePower) error) error
|
|
|
|
}
|