/
actor.go
51 lines (42 loc) · 963 Bytes
/
actor.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package types
import (
"errors"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
)
var ErrActorNotFound = errors.New("actor not found")
// Actor State for state tree version up to 4
type ActorV4 struct {
// Identifies the type of actor (string coded as a CID), see `chain/actors/actors.go`.
Code cid.Cid
Head cid.Cid
Nonce uint64
Balance BigInt
}
// Actor State for state tree version 5
type ActorV5 struct {
// Identifies the type of actor (string coded as a CID), see `chain/actors/actors.go`.
Code cid.Cid
Head cid.Cid
Nonce uint64
Balance BigInt
// Deterministic Address.
Address *address.Address
}
type Actor = ActorV5
func AsActorV4(a *ActorV5) *ActorV4 {
return &ActorV4{
Code: a.Code,
Head: a.Head,
Nonce: a.Nonce,
Balance: a.Balance,
}
}
func AsActorV5(a *ActorV4) *ActorV5 {
return &ActorV5{
Code: a.Code,
Head: a.Head,
Nonce: a.Nonce,
Balance: a.Balance,
}
}