StatusCode

enum StatusCode {
  ok = 0;

  // common code
  // 1 - 15
  invalid_nonce = 1;
  invalid_signature = 2;
  invalid_sender_state = 3;
  invalid_receiver_state = 4;
  insufficient_data = 5;
  insufficient_fund = 6;
  invalid_owner = 7;
  invalid_tx = 8;
  unsupported_tx = 9;
  expired_tx = 10;
  too_many_txs = 11;
  invalid_lock_status = 12;
  invalid_request = 13;

  // 16 - 2047 various errors
  invalid_moniker = 16;
  invalid_passphrase = 17;

  invalid_multisig = 20;
  invalid_wallet = 21;
  invalid_chain_id = 22;

  consensus_rpc_error = 24;
  storage_rpc_error = 25;
  noent = 26;
  account_migrated = 27;

  unsupported_stake = 30;
  insufficient_stake = 31;
  invalid_stake_state = 32;
  expired_wallet_token = 33;
  banned_unstake = 34;
  invalid_asset = 35;
  invalid_tx_size = 36;
  invalid_signer_state = 37;
  invalid_forge_state = 38;
  expired_asset = 39;
  untransferrable_asset = 40;
  readonly_asset = 41;
  consumed_asset = 42;
  invalid_deposit_value = 43;
  exceed_deposit_cap = 44;
  invalid_deposit_target = 45;
  invalid_depositor = 46;
  invalid_withdrawer = 47;
  duplicate_tether = 48;
  invalid_expiry_date = 49;
  invalid_deposit = 50;
  invalid_custodian = 51;
  insufficient_gas = 52;
  invalid_swap = 53;
  invalid_hashkey = 54;
  invalid_delegation = 55;
  insufficient_delegation = 56;
  invalid_delegation_rule = 57;
  invalid_delegation_type_url = 58;

  sender_not_authorized =59;
  protocol_not_running=60;
  protocol_not_paused=61;
  protocol_not_activated=62;
  invalid_deactivation=63;

  forbidden = 403;
  internal = 500;
  timeout = 504;

  // user defined status code shall start from 600
}

KeyType

enum KeyType {
  ed25519 = 0;
  secp256k1 = 1;
}

HashType

enum HashType {
  keccak = 0;
  sha3 = 1;
  sha2 = 2;

  // 3-5 reserved

  keccak_384 = 6;
  sha3_384 = 7;

  // 9-12 reserved

  keccak_512 = 13;
  sha3_512 = 14;
}

EncodingType

enum EncodingType {
  base16 = 0;
  base58 = 1;
}

RoleType

enum RoleType {
  role_account = 0;
  role_node = 1;
  role_device = 2;
  role_application = 3;
  role_smart_contract = 4;
  role_bot = 5;
  role_asset = 6;
  role_stake = 7;
  role_validator = 8;
  role_group = 9;
  role_tx = 10;
  role_tether = 11;
  role_any = 63;
}

UpgradeAction

enum UpgradeAction {
  verify = 0;
  backup = 1;
  replace = 2;

  // restart different part of the system
  restart_app = 10;
  restart_dfs = 11;
  restart_consensus = 12;
  restart_p2p = 13;
  // restart forge will indirectly restart all component in a graceful manner
  restart_forge = 14;

  // depend on deployment, the monitor app (e.g. systemd) shall bring the
  // process back
  rollback_if_fail = 30;
  restart_all_if_fail = 31;
  crash_if_fail = 33;

  // drop different intermediate files
  drop_address_book = 50;
}

UpgradeType

enum UpgradeType {
  // configuration
  config_app = 0;
  config_forge = 1;
  config_dfs = 2;
  config_consensus = 3;
  config_p2p = 4;

  // executable
  exe_app = 10;
  exe_forge = 11;
  exe_dfs = 12;
  exe_consensus = 13;
  exe_p2p = 14;
}

StateType

enum StateType {
  state_account = 0;
  state_asset = 1;
  state_channel = 2;
  state_forge = 3;
  state_stake = 4;
}

StakeType

enum StakeType {
  stake_node = 0;
  stake_user = 1;
  stake_asset = 2;
  stake_chain = 3;
}

ProtocolStatus

enum ProtocolStatus {
  running = 0;
  paused = 1;
  terminated = 2;
}