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
use num_derive::FromPrimitive;

/// Identifies the builtin actor types for usage with the
/// actor::resolve_builtin_actor_type syscall.
/// Note that there is a mirror of this enum in the FVM SDK src/actors/builtins.rs.
/// These must be kept in sync for the syscall to work correctly, without either side
/// importing the other.
#[derive(PartialEq, Eq, Clone, Copy, PartialOrd, Ord, FromPrimitive, Debug)]
#[repr(i32)]
pub enum Type {
    System = 1,
    Init = 2,
    Cron = 3,
    Account = 4,
    Power = 5,
    Miner = 6,
    Market = 7,
    PaymentChannel = 8,
    Multisig = 9,
    Reward = 10,
    VerifiedRegistry = 11,
    DataCap = 12,
    Placeholder = 13,
    EVM = 14,
    EAM = 15,
    EthAccount = 16,
}

impl Type {
    pub fn name(&self) -> &'static str {
        match *self {
            Type::System => "system",
            Type::Init => "init",
            Type::Cron => "cron",
            Type::Account => "account",
            Type::Power => "storagepower",
            Type::Miner => "storageminer",
            Type::Market => "storagemarket",
            Type::PaymentChannel => "paymentchannel",
            Type::Multisig => "multisig",
            Type::Reward => "reward",
            Type::VerifiedRegistry => "verifiedregistry",
            Type::DataCap => "datacap",
            Type::Placeholder => "placeholder",
            Type::EVM => "evm",
            Type::EAM => "eam",
            Type::EthAccount => "ethaccount",
        }
    }
}