2019-11-22 22:51:44 +00:00
|
|
|
package actors
|
|
|
|
|
|
|
|
import (
|
2019-12-19 20:13:17 +00:00
|
|
|
"github.com/filecoin-project/go-address"
|
2019-11-22 22:51:44 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
type CronActor struct{}
|
|
|
|
|
|
|
|
type callTuple struct {
|
|
|
|
addr address.Address
|
|
|
|
method uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
var CronActors = []callTuple{
|
|
|
|
{StoragePowerAddress, SPAMethods.CheckProofSubmissions},
|
|
|
|
}
|
|
|
|
|
|
|
|
type CronActorState struct{}
|
|
|
|
|
|
|
|
type cAMethods struct {
|
|
|
|
EpochTick uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
var CAMethods = cAMethods{2}
|
|
|
|
|
|
|
|
func (ca CronActor) Exports() []interface{} {
|
|
|
|
return []interface{}{
|
|
|
|
1: nil,
|
|
|
|
2: ca.EpochTick,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (ca CronActor) EpochTick(act *types.Actor, vmctx types.VMContext, params *struct{}) ([]byte, ActorError) {
|
|
|
|
if vmctx.Message().From != CronAddress {
|
|
|
|
return nil, aerrors.New(1, "EpochTick is only callable as a part of tipset state computation")
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, call := range CronActors {
|
|
|
|
_, err := vmctx.Send(call.addr, call.method, types.NewInt(0), nil)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err // todo: this very bad?
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil, nil
|
|
|
|
}
|