github.com/filecoin-project/specs-actors/v4@v4.0.2/actors/builtin/system/system_actor.go (about)

     1  package system
     2  
     3  import (
     4  	"github.com/filecoin-project/go-state-types/abi"
     5  	"github.com/filecoin-project/go-state-types/cbor"
     6  	"github.com/ipfs/go-cid"
     7  
     8  	"github.com/filecoin-project/specs-actors/v4/actors/builtin"
     9  	"github.com/filecoin-project/specs-actors/v4/actors/runtime"
    10  )
    11  
    12  type Actor struct{}
    13  
    14  func (a Actor) Exports() []interface{} {
    15  	return []interface{}{
    16  		builtin.MethodConstructor: a.Constructor,
    17  	}
    18  }
    19  
    20  func (a Actor) Code() cid.Cid {
    21  	return builtin.SystemActorCodeID
    22  }
    23  
    24  func (a Actor) IsSingleton() bool {
    25  	return true
    26  }
    27  
    28  func (a Actor) State() cbor.Er {
    29  	return new(State)
    30  }
    31  
    32  var _ runtime.VMActor = Actor{}
    33  
    34  func (a Actor) Constructor(rt runtime.Runtime, _ *abi.EmptyValue) *abi.EmptyValue {
    35  	rt.ValidateImmediateCallerIs(builtin.SystemActorAddr)
    36  
    37  	rt.StateCreate(&State{})
    38  	return nil
    39  }
    40  
    41  type State struct{}