Documentation ¶
Index ¶
- Constants
- Variables
- func BigCmp(a, b BigInt) int
- func BigDivFloat(num, den BigInt) float64
- type Actor
- type BigInt
- type ChainMsg
- type FIL
- func (f FIL) Format(s fmt.State, ch rune)
- func (f FIL) MarshalJSON() ([]byte, error)
- func (f FIL) MarshalText() (text []byte, err error)
- func (f FIL) Nano() string
- func (f FIL) Short() string
- func (f FIL) String() string
- func (f FIL) Unitless() string
- func (f *FIL) UnmarshalJSON(by []byte) error
- func (f FIL) UnmarshalText(text []byte) error
- type Message
- func (m *Message) ChainLength() int
- func (m *Message) Cid() cid.Cid
- func (m *Message) EqualCall(o *Message) bool
- func (m *Message) Equals(o *Message) bool
- func (t *Message) MarshalCBOR(w io.Writer) error
- func (m *Message) MarshalJSON() ([]byte, error)
- func (m *Message) RequiredFunds() abi.TokenAmount
- func (m *Message) Serialize() ([]byte, error)
- func (m *Message) SerializeWithCid() (cid.Cid, []byte, error)
- func (m *Message) String() string
- func (m *Message) ToStorageBlock() (blocks.Block, error)
- func (t *Message) UnmarshalCBOR(r io.Reader) (err error)
- func (m *Message) VMMessage() *Message
- func (m *Message) ValidForBlockInclusion(minGas int64, version network.Version) error
- type RawMessage
Constants ¶
const MessageVersion = 0
Variables ¶
var ( AttoFil = NewInt(1) FemtoFil = BigMul(AttoFil, NewInt(1000)) PicoFil = BigMul(FemtoFil, NewInt(1000)) NanoFil = BigMul(PicoFil, NewInt(1000)) )
var EmptyInt = BigInt{}
var ErrActorNotFound = errors.New("actor not found")
var TotalFilecoinInt = FromFil(params.FilBase)
var ZeroAddress = func() address.Address { addr := "f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a" ret, err := address.NewFromString(addr) if err != nil { panic(err) } return ret }()
var ZeroFIL = fbig.NewInt(0)
Functions ¶
func BigDivFloat ¶
Types ¶
type Actor ¶
type Actor struct { // Code is a CID of the VM code for this actor's implementation (or a constant for actors implemented in Go code). // Code may be nil for an uninitialized actor (which exists because it has received a balance). Code cid.Cid // Head is the CID of the root of the actor's state tree. Head cid.Cid // Nonce is the number expected on the next message from this actor. // Messages are processed in strict, contiguous order. Nonce uint64 // Balance is the amount of attoFIL in the actor's account. Balance abi.TokenAmount }
Actor is the central abstraction of entities in the system.
Both individual accounts, as well as contracts (user & system level) are represented as actors. An actor has the following core functionality implemented on a system level: - track a Filecoin balance, using the `Balance` field - execute code stored in the `Code` field - read & write memory - replay protection, using the `Nonce` field
Value sent to a non-existent address will be tracked as an empty actor that has a Balance but nil Code and Memory. You must nil check Code cids before comparing them.
More specific capabilities for individual accounts or contract specific must be implemented inside the code.
Not safe for concurrent access.
func NewActor ¶
func NewActor(code cid.Cid, balance abi.TokenAmount, head cid.Cid) *Actor
NewActor constructs a new actor.
func (*Actor) IncrementSeqNum ¶
func (t *Actor) IncrementSeqNum()
IncrementSeqNum increments the seq number.
type FIL ¶
type FIL BigInt
func MustParseFIL ¶
func (FIL) MarshalJSON ¶
func (FIL) MarshalText ¶
func (*FIL) UnmarshalJSON ¶
func (FIL) UnmarshalText ¶
type Message ¶
type Message struct { Version uint64 To address.Address From address.Address // When receiving a message from a user account the nonce in // the message must match the expected nonce in the from actor. // This prevents replay attacks. Nonce uint64 Value abi.TokenAmount GasLimit int64 GasFeeCap abi.TokenAmount GasPremium abi.TokenAmount Method abi.MethodNum Params []byte }
func DecodeMessage ¶
func (*Message) ChainLength ¶
func (*Message) MarshalJSON ¶
func (*Message) RequiredFunds ¶
func (m *Message) RequiredFunds() abi.TokenAmount
func (*Message) SerializeWithCid ¶
type RawMessage ¶
type RawMessage Message