fil_actors_runtime_v9/runtime/
builtins.rs

1// Copyright 2019-2022 ChainSafe Systems
2// SPDX-License-Identifier: Apache-2.0, MIT
3
4use num_derive::FromPrimitive;
5
6/// Identifies the builtin actor types for usage with the
7/// `actor::resolve_builtin_actor_type` syscall.
8/// Note that there is a mirror of this enumerable in the FVM SDK `src/actors/builtins.rs`.
9/// These must be kept in sync for the syscall to work correctly, without either side
10/// importing the other.
11#[derive(PartialEq, Eq, Clone, Copy, PartialOrd, Ord, FromPrimitive, Debug)]
12#[repr(i32)]
13pub enum Type {
14    System = 1,
15    Init = 2,
16    Cron = 3,
17    Account = 4,
18    Power = 5,
19    Miner = 6,
20    Market = 7,
21    PaymentChannel = 8,
22    Multisig = 9,
23    Reward = 10,
24    VerifiedRegistry = 11,
25    DataCap = 12,
26}
27
28impl Type {
29    pub fn name(&self) -> &'static str {
30        match *self {
31            Type::System => "system",
32            Type::Init => "init",
33            Type::Cron => "cron",
34            Type::Account => "account",
35            Type::Power => "storagepower",
36            Type::Miner => "storageminer",
37            Type::Market => "storagemarket",
38            Type::PaymentChannel => "paymentchannel",
39            Type::Multisig => "multisig",
40            Type::Reward => "reward",
41            Type::VerifiedRegistry => "verifiedregistry",
42            Type::DataCap => "datacap",
43        }
44    }
45}