Scorum
nft_object.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <fc/fixed_string.hpp>
4 #include <fc/shared_string.hpp>
5 #include <fc/uint128.hpp>
6 
9 
10 #include <boost/multi_index/composite_key.hpp>
11 #include <boost/multi_index/hashed_index.hpp>
12 
13 #include <numeric>
14 
15 namespace scorum {
16 namespace chain {
17 
18 class nft_object : public object<nft_object_type, nft_object>
19 {
20 public:
22 
23  id_type id;
27  int32_t initial_power;
29 
30  fc::shared_string json_metadata;
31  time_point_sec created;
32 };
33 
34 class game_round_object : public object<game_round_object_type, game_round_object>
35 {
36 public:
38 
39  id_type id;
42 
43  fc::shared_string seed;
44  fc::shared_string verification_key;
45  fc::shared_string vrf;
46  fc::shared_string proof;
47  int32_t result;
48 };
49 
50 struct by_uuid;
51 struct by_name;
52 
53 // clang-format off
54 using nft_index = shared_multi_index_container<
55  nft_object, indexed_by<
56  ordered_unique<tag<by_id>, member<nft_object, nft_id_type, &nft_object::id>>,
57  hashed_unique<tag<by_uuid>, member<nft_object, uuid_type, &nft_object::uuid>>,
58  hashed_unique<tag<by_name>, member<nft_object, account_name_type, &nft_object::name>>
59  >>;
60 
61 using game_round_index = shared_multi_index_container<
62  game_round_object, indexed_by<
63  ordered_unique<tag<by_id>, member<game_round_object, game_round_id_type, &game_round_object::id>>,
64  hashed_unique<tag<by_uuid>, member<game_round_object, uuid_type, &game_round_object::uuid>>
65  >>;
66 // clang-format on
67 
68 } // namespace chain
69 } // namespace scorum
70 
71 // clang-format off
72 
74  (id)
75  (uuid)
76  (owner)
77  (name)
78  (initial_power)
79  (experience)
80  (json_metadata)
81  (created))
82 
83 CHAINBASE_SET_INDEX_TYPE(scorum::chain::nft_object, scorum::chain::nft_index)
84 
86  (id)
87  (uuid)
88  (owner)
89  (seed)
90  (verification_key)
91  (vrf)
92  (proof)
93  (result))
94 
96 
97 // clang-format on
CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(game_round_object,(seed)(verification_key)(vrf)(proof))
fc::shared_string verification_key
Definition: nft_object.hpp:44
account_name_type owner
Definition: nft_object.hpp:25
fc::shared_string json_metadata
Definition: nft_object.hpp:30
time_point_sec created
Definition: nft_object.hpp:31
CHAINBASE_DEFAULT_DYNAMIC_CONSTRUCTOR(nft_object,(json_metadata))
account_name_type name
Definition: nft_object.hpp:26
FC_REFLECT(appender_args,(appender)(stream)) FC_REFLECT_DERIVED(file_appender_args
shared_multi_index_container< nft_object, indexed_by< ordered_unique< tag< by_id >, member< nft_object, nft_id_type, &nft_object::id > >, hashed_unique< tag< by_uuid >, member< nft_object, uuid_type, &nft_object::uuid > >, hashed_unique< tag< by_name >, member< nft_object, account_name_type, &nft_object::name > > > > nft_index
Definition: nft_object.hpp:59
shared_multi_index_container< game_round_object, indexed_by< ordered_unique< tag< by_id >, member< game_round_object, game_round_id_type, &game_round_object::id > >, hashed_unique< tag< by_uuid >, member< game_round_object, uuid_type, &game_round_object::uuid > > > > game_round_index
Definition: nft_object.hpp:65
fc::safe< share_value_type > share_type
Definition: types.hpp:73
fc::fixed_string_16 account_name_type
Definition: types.hpp:62
Definition: asset.cpp:15
boost::uuids::uuid uuid_type
Definition: types.hpp:53