0

这几天我一直在挠头。一步一步地删除和添加行并在每个阶段重新编译,直到它中断。

  ACTION act1(name nm, uint64_t amount);
  ACTION act2(name nm, uint64_t signing_value);
  ACTION receiverand(name nm, checksum256& random_value);
  ACTION act4(name nm, uint64_t stake);
  ACTION act5(uint64_t num);
  ACTION act6(name nm);

  using act1_action = action_wrapper<"act1"_n, &project::act1>;
  using act2_action = action_wrapper<"act2"_n, &project::act2>;
  using receiverand_action = action_wrapper<"receiverand"_n, &project::receiverand>;
  using act4_action = action_wrapper<"act4"_n, &project::act4>;
  using act5_action = action_wrapper<"act5"_n, &project::act5>;
  using act6_action = action_wrapper<"act6"_n, &project::act6>;

当我添加act6时出现问题。我必须采取行动4,一切正常。所以我加了 5 和 6,然后抛出了错误,所以我又加了 5,一切都还好。这是我不断收到的错误

 error: constexpr variable 'x' must be initialized by a constant expression
        constexpr auto x = 
        eosio::name{std::string_view{eosio::detail::to_const_char_arr<Str...>::value, 
        sizeof...(Str)}};

  note: in instantiation of function template specialization 'operator""_n<char, 'a', 
        'c', 't', '6'>' requested here
        using act6_action = action_wrapper<"act6"_n, &project::act6>;

 note: non-constexpr function 'check' cannot be used in a constant expression
       eosio::check( false, "character is not in allowed character set for names" );
4

1 回答 1

2

似乎一个名字不能包含字符'6',而只能是'1'thru '5'

Action names [...] May contain: a-z, 1-5, or .

https://eosio.stackexchange.com/questions/7/what-are-naming-rules-for-actions-tables-and-contracts

于 2021-12-06T09:29:53.810 回答