Adapt to variant API with max_depth argument
This commit is contained in:
parent
94f9c5f3eb
commit
cb99aaa0cf
19 changed files with 189 additions and 212 deletions
|
|
@ -218,7 +218,7 @@ namespace graphene { namespace app {
|
|||
|
||||
if (_on_pending_transaction)
|
||||
{
|
||||
_on_pending_transaction(fc::variant(transaction));
|
||||
_on_pending_transaction(fc::variant(transaction, GRAPHENE_MAX_NESTED_OBJECTS));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -543,35 +543,35 @@ void betting_market_group_object::dispatch_new_status(database& db, betting_mark
|
|||
|
||||
namespace fc {
|
||||
// Manually reflect betting_market_group_object to variant to properly reflect "state"
|
||||
void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v)
|
||||
void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth)
|
||||
{
|
||||
fc::mutable_variant_object o;
|
||||
o("id", betting_market_group_obj.id)
|
||||
("description", betting_market_group_obj.description)
|
||||
("event_id", betting_market_group_obj.event_id)
|
||||
("rules_id", betting_market_group_obj.rules_id)
|
||||
("asset_id", betting_market_group_obj.asset_id)
|
||||
("total_matched_bets_amount", betting_market_group_obj.total_matched_bets_amount)
|
||||
("never_in_play", betting_market_group_obj.never_in_play)
|
||||
("delay_before_settling", betting_market_group_obj.delay_before_settling)
|
||||
("settling_time", betting_market_group_obj.settling_time)
|
||||
("status", betting_market_group_obj.get_status());
|
||||
o("id", fc::variant(betting_market_group_obj.id, max_depth))
|
||||
("description", fc::variant(betting_market_group_obj.description, max_depth))
|
||||
("event_id", fc::variant(betting_market_group_obj.event_id, max_depth))
|
||||
("rules_id", fc::variant(betting_market_group_obj.rules_id, max_depth))
|
||||
("asset_id", fc::variant(betting_market_group_obj.asset_id, max_depth))
|
||||
("total_matched_bets_amount", fc::variant(betting_market_group_obj.total_matched_bets_amount, max_depth))
|
||||
("never_in_play", fc::variant(betting_market_group_obj.never_in_play, max_depth))
|
||||
("delay_before_settling", fc::variant(betting_market_group_obj.delay_before_settling, max_depth))
|
||||
("settling_time", fc::variant(betting_market_group_obj.settling_time, max_depth))
|
||||
("status", fc::variant(betting_market_group_obj.get_status(), max_depth));
|
||||
|
||||
v = o;
|
||||
}
|
||||
|
||||
// Manually reflect betting_market_group_object to variant to properly reflect "state"
|
||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj)
|
||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth)
|
||||
{
|
||||
betting_market_group_obj.id = v["id"].as<graphene::chain::betting_market_group_id_type>();
|
||||
betting_market_group_obj.description = v["description"].as<graphene::chain::internationalized_string_type>();
|
||||
betting_market_group_obj.event_id = v["event_id"].as<graphene::chain::event_id_type>();
|
||||
betting_market_group_obj.asset_id = v["asset_id"].as<graphene::chain::asset_id_type>();
|
||||
betting_market_group_obj.total_matched_bets_amount = v["total_matched_bets_amount"].as<graphene::chain::share_type>();
|
||||
betting_market_group_obj.never_in_play = v["never_in_play"].as<bool>();
|
||||
betting_market_group_obj.delay_before_settling = v["delay_before_settling"].as<uint32_t>();
|
||||
betting_market_group_obj.settling_time = v["settling_time"].as<fc::optional<fc::time_point_sec>>();
|
||||
graphene::chain::betting_market_group_status status = v["status"].as<graphene::chain::betting_market_group_status>();
|
||||
betting_market_group_obj.id = v["id"].as<graphene::chain::betting_market_group_id_type>( max_depth );
|
||||
betting_market_group_obj.description = v["description"].as<graphene::chain::internationalized_string_type>( max_depth );
|
||||
betting_market_group_obj.event_id = v["event_id"].as<graphene::chain::event_id_type>( max_depth );
|
||||
betting_market_group_obj.asset_id = v["asset_id"].as<graphene::chain::asset_id_type>( max_depth );
|
||||
betting_market_group_obj.total_matched_bets_amount = v["total_matched_bets_amount"].as<graphene::chain::share_type>( max_depth );
|
||||
betting_market_group_obj.never_in_play = v["never_in_play"].as<bool>( max_depth );
|
||||
betting_market_group_obj.delay_before_settling = v["delay_before_settling"].as<uint32_t>( max_depth );
|
||||
betting_market_group_obj.settling_time = v["settling_time"].as<fc::optional<fc::time_point_sec>>( max_depth );
|
||||
graphene::chain::betting_market_group_status status = v["status"].as<graphene::chain::betting_market_group_status>( max_depth );
|
||||
const_cast<int*>(betting_market_group_obj.my->state_machine.current_state())[0] = (int)status;
|
||||
}
|
||||
} //end namespace fc
|
||||
|
|
|
|||
|
|
@ -468,28 +468,28 @@ void betting_market_object::on_canceled_event(database& db)
|
|||
|
||||
namespace fc {
|
||||
// Manually reflect betting_market_object to variant to properly reflect "state"
|
||||
void to_variant(const graphene::chain::betting_market_object& event_obj, fc::variant& v)
|
||||
void to_variant(const graphene::chain::betting_market_object& event_obj, fc::variant& v, uint32_t max_depth)
|
||||
{
|
||||
fc::mutable_variant_object o;
|
||||
o("id", event_obj.id)
|
||||
("group_id", event_obj.group_id)
|
||||
("description", event_obj.description)
|
||||
("payout_condition", event_obj.payout_condition)
|
||||
("resolution", event_obj.resolution)
|
||||
("status", event_obj.get_status());
|
||||
o("id", fc::variant(event_obj.id, max_depth) )
|
||||
("group_id", fc::variant(event_obj.group_id, max_depth))
|
||||
("description", fc::variant(event_obj.description, max_depth))
|
||||
("payout_condition", fc::variant(event_obj.payout_condition, max_depth))
|
||||
("resolution", fc::variant(event_obj.resolution, max_depth))
|
||||
("status", fc::variant(event_obj.get_status(), max_depth));
|
||||
|
||||
v = o;
|
||||
}
|
||||
|
||||
// Manually reflect betting_market_object to variant to properly reflect "state"
|
||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_object& event_obj)
|
||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_object& event_obj, uint32_t max_depth)
|
||||
{
|
||||
event_obj.id = v["id"].as<graphene::chain::betting_market_id_type>();
|
||||
event_obj.group_id = v["name"].as<graphene::chain::betting_market_group_id_type>();
|
||||
event_obj.description = v["description"].as<graphene::chain::internationalized_string_type>();
|
||||
event_obj.payout_condition = v["payout_condition"].as<graphene::chain::internationalized_string_type>();
|
||||
event_obj.resolution = v["resolution"].as<fc::optional<graphene::chain::betting_market_resolution_type>>();
|
||||
graphene::chain::betting_market_status status = v["status"].as<graphene::chain::betting_market_status>();
|
||||
event_obj.id = v["id"].as<graphene::chain::betting_market_id_type>( max_depth );
|
||||
event_obj.group_id = v["name"].as<graphene::chain::betting_market_group_id_type>( max_depth );
|
||||
event_obj.description = v["description"].as<graphene::chain::internationalized_string_type>( max_depth );
|
||||
event_obj.payout_condition = v["payout_condition"].as<graphene::chain::internationalized_string_type>( max_depth );
|
||||
event_obj.resolution = v["resolution"].as<fc::optional<graphene::chain::betting_market_resolution_type>>( max_depth );
|
||||
graphene::chain::betting_market_status status = v["status"].as<graphene::chain::betting_market_status>( max_depth );
|
||||
const_cast<int*>(event_obj.my->state_machine.current_state())[0] = (int)status;
|
||||
}
|
||||
} //end namespace fc
|
||||
|
|
|
|||
|
|
@ -118,10 +118,10 @@ void debug_apply_update( database& db, const fc::variant_object& vo )
|
|||
auto it_id = vo.find("id");
|
||||
FC_ASSERT( it_id != vo.end() );
|
||||
|
||||
from_variant( it_id->value(), oid );
|
||||
from_variant( it_id->value(), oid, GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
action = ( vo.size() == 1 ) ? db_action_delete : db_action_write;
|
||||
|
||||
from_variant( vo["id"], oid );
|
||||
from_variant( vo["id"], oid, GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
if( vo.size() == 1 )
|
||||
action = db_action_delete;
|
||||
auto it_action = vo.find("_action" );
|
||||
|
|
|
|||
|
|
@ -739,7 +739,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
vbo.owner = get_account_id(account.name);
|
||||
vbo.balance = asset(vesting_balance.amount, get_asset_id(vesting_balance.asset_symbol));
|
||||
if (vesting_balance.policy_type == "linear") {
|
||||
auto initial_linear_vesting_policy = vesting_balance.policy.as<genesis_state_type::initial_bts_account_type::initial_linear_vesting_policy>();
|
||||
auto initial_linear_vesting_policy = vesting_balance.policy.as<genesis_state_type::initial_bts_account_type::initial_linear_vesting_policy>( 20 );
|
||||
linear_vesting_policy new_vesting_policy;
|
||||
new_vesting_policy.begin_timestamp = initial_linear_vesting_policy.begin_timestamp;
|
||||
new_vesting_policy.vesting_cliff_seconds = initial_linear_vesting_policy.vesting_cliff_seconds;
|
||||
|
|
@ -747,7 +747,7 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
|||
new_vesting_policy.begin_balance = initial_linear_vesting_policy.begin_balance;
|
||||
vbo.policy = new_vesting_policy;
|
||||
} else if (vesting_balance.policy_type == "cdd") {
|
||||
auto initial_cdd_vesting_policy = vesting_balance.policy.as<genesis_state_type::initial_bts_account_type::initial_cdd_vesting_policy>();
|
||||
auto initial_cdd_vesting_policy = vesting_balance.policy.as<genesis_state_type::initial_bts_account_type::initial_cdd_vesting_policy>( 20 );
|
||||
cdd_vesting_policy new_vesting_policy;
|
||||
new_vesting_policy.vesting_seconds = initial_cdd_vesting_policy.vesting_seconds;
|
||||
new_vesting_policy.coin_seconds_earned = initial_cdd_vesting_policy.coin_seconds_earned;
|
||||
|
|
|
|||
|
|
@ -553,30 +553,30 @@ namespace graphene { namespace chain {
|
|||
|
||||
namespace fc {
|
||||
// Manually reflect event_object to variant to properly reflect "state"
|
||||
void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v)
|
||||
void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth)
|
||||
{
|
||||
fc::mutable_variant_object o;
|
||||
o("id", event_obj.id)
|
||||
("name", event_obj.name)
|
||||
("season", event_obj.season)
|
||||
("start_time", event_obj.start_time)
|
||||
("event_group_id", event_obj.event_group_id)
|
||||
("scores", event_obj.scores)
|
||||
("status", event_obj.get_status());
|
||||
o("id", fc::variant(event_obj.id, max_depth))
|
||||
("name", fc::variant(event_obj.name, max_depth))
|
||||
("season", fc::variant(event_obj.season, max_depth))
|
||||
("start_time", fc::variant(event_obj.start_time, max_depth))
|
||||
("event_group_id", fc::variant(event_obj.event_group_id, max_depth))
|
||||
("scores", fc::variant(event_obj.scores, max_depth))
|
||||
("status", fc::variant(event_obj.get_status(), max_depth));
|
||||
|
||||
v = o;
|
||||
}
|
||||
|
||||
// Manually reflect event_object to variant to properly reflect "state"
|
||||
void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj)
|
||||
void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth)
|
||||
{
|
||||
event_obj.id = v["id"].as<graphene::chain::event_id_type>();
|
||||
event_obj.name = v["name"].as<graphene::chain::internationalized_string_type>();
|
||||
event_obj.season = v["season"].as<graphene::chain::internationalized_string_type>();
|
||||
event_obj.start_time = v["start_time"].as<optional<time_point_sec> >();
|
||||
event_obj.event_group_id = v["event_group_id"].as<graphene::chain::event_group_id_type>();
|
||||
event_obj.scores = v["scores"].as<std::vector<std::string>>();
|
||||
graphene::chain::event_status status = v["status"].as<graphene::chain::event_status>();
|
||||
event_obj.id = v["id"].as<graphene::chain::event_id_type>( max_depth );
|
||||
event_obj.name = v["name"].as<graphene::chain::internationalized_string_type>( max_depth );
|
||||
event_obj.season = v["season"].as<graphene::chain::internationalized_string_type>( max_depth );
|
||||
event_obj.start_time = v["start_time"].as<optional<time_point_sec> >( max_depth );
|
||||
event_obj.event_group_id = v["event_group_id"].as<graphene::chain::event_group_id_type>( max_depth );
|
||||
event_obj.scores = v["scores"].as<std::vector<std::string>>( max_depth );
|
||||
graphene::chain::event_status status = v["status"].as<graphene::chain::event_status>( max_depth );
|
||||
const_cast<int*>(event_obj.my->state_machine.current_state())[0] = (int)status;
|
||||
}
|
||||
} //end namespace fc
|
||||
|
|
|
|||
|
|
@ -549,33 +549,33 @@ namespace graphene { namespace chain {
|
|||
|
||||
namespace fc {
|
||||
// Manually reflect game_object to variant to properly reflect "state"
|
||||
void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v)
|
||||
void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth)
|
||||
{
|
||||
fc_elog(fc::logger::get("tournament"), "In game_obj to_variant");
|
||||
elog("In game_obj to_variant");
|
||||
fc::mutable_variant_object o;
|
||||
o("id", game_obj.id)
|
||||
("match_id", game_obj.match_id)
|
||||
("players", game_obj.players)
|
||||
("winners", game_obj.winners)
|
||||
("game_details", game_obj.game_details)
|
||||
("next_timeout", game_obj.next_timeout)
|
||||
("state", game_obj.get_state());
|
||||
o("id", fc::variant(game_obj.id, max_depth ))
|
||||
("match_id", fc::variant(game_obj.match_id, max_depth ))
|
||||
("players", fc::variant(game_obj.players, max_depth ))
|
||||
("winners", fc::variant(game_obj.winners, max_depth ))
|
||||
("game_details", fc::variant(game_obj.game_details, max_depth ))
|
||||
("next_timeout", fc::variant(game_obj.next_timeout, max_depth ))
|
||||
("state", fc::variant(game_obj.get_state(), max_depth ));
|
||||
|
||||
v = o;
|
||||
}
|
||||
|
||||
// Manually reflect game_object to variant to properly reflect "state"
|
||||
void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj)
|
||||
void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth)
|
||||
{
|
||||
fc_elog(fc::logger::get("tournament"), "In game_obj from_variant");
|
||||
game_obj.id = v["id"].as<graphene::chain::game_id_type>();
|
||||
game_obj.match_id = v["match_id"].as<graphene::chain::match_id_type>();
|
||||
game_obj.players = v["players"].as<std::vector<graphene::chain::account_id_type> >();
|
||||
game_obj.winners = v["winners"].as<flat_set<graphene::chain::account_id_type> >();
|
||||
game_obj.game_details = v["game_details"].as<graphene::chain::game_specific_details>();
|
||||
game_obj.next_timeout = v["next_timeout"].as<fc::optional<time_point_sec> >();
|
||||
graphene::chain::game_state state = v["state"].as<graphene::chain::game_state>();
|
||||
game_obj.id = v["id"].as<graphene::chain::game_id_type>( max_depth );
|
||||
game_obj.match_id = v["match_id"].as<graphene::chain::match_id_type>( max_depth );
|
||||
game_obj.players = v["players"].as<std::vector<graphene::chain::account_id_type> >( max_depth );
|
||||
game_obj.winners = v["winners"].as<flat_set<graphene::chain::account_id_type> >( max_depth );
|
||||
game_obj.game_details = v["game_details"].as<graphene::chain::game_specific_details>( max_depth );
|
||||
game_obj.next_timeout = v["next_timeout"].as<fc::optional<time_point_sec> >( max_depth );
|
||||
graphene::chain::game_state state = v["state"].as<graphene::chain::game_state>( max_depth );
|
||||
const_cast<int*>(game_obj.my->state_machine.current_state())[0] = (int)state;
|
||||
}
|
||||
} //end namespace fc
|
||||
|
|
|
|||
|
|
@ -37,10 +37,10 @@ namespace graphene { namespace chain {
|
|||
} }
|
||||
|
||||
namespace fc {
|
||||
void to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v);
|
||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj);
|
||||
void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v);
|
||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj);
|
||||
void to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj, uint32_t max_depth = 1);
|
||||
void to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||
void from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth = 1);
|
||||
} //end namespace fc
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
|
@ -110,8 +110,8 @@ class betting_market_group_object : public graphene::db::abstract_object< bettin
|
|||
template<typename Stream>
|
||||
friend Stream& operator>>( Stream& s, betting_market_group_object& betting_market_group_obj );
|
||||
|
||||
friend void ::fc::to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj);
|
||||
friend void ::fc::to_variant(const graphene::chain::betting_market_group_object& betting_market_group_obj, fc::variant& v, uint32_t max_depth);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::betting_market_group_object& betting_market_group_obj, uint32_t max_depth);
|
||||
|
||||
void pack_impl(std::ostream& stream) const;
|
||||
void unpack_impl(std::istream& stream);
|
||||
|
|
@ -166,8 +166,8 @@ class betting_market_object : public graphene::db::abstract_object< betting_mark
|
|||
template<typename Stream>
|
||||
friend Stream& operator>>( Stream& s, betting_market_object& betting_market_obj );
|
||||
|
||||
friend void ::fc::to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj);
|
||||
friend void ::fc::to_variant(const graphene::chain::betting_market_object& betting_market_obj, fc::variant& v, uint32_t max_depth);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::betting_market_object& betting_market_obj, uint32_t max_depth);
|
||||
|
||||
void pack_impl(std::ostream& stream) const;
|
||||
void unpack_impl(std::istream& stream);
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ namespace graphene { namespace chain {
|
|||
} }
|
||||
|
||||
namespace fc {
|
||||
void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v);
|
||||
void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj);
|
||||
void to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||
void from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth = 1);
|
||||
} //end namespace fc
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
|
@ -77,8 +77,8 @@ class event_object : public graphene::db::abstract_object< event_object >
|
|||
template<typename Stream>
|
||||
friend Stream& operator>>( Stream& s, event_object& event_obj );
|
||||
|
||||
friend void ::fc::to_variant(const graphene::chain::event_object& event_obj, fc::variant& v);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::event_object& event_obj);
|
||||
friend void ::fc::to_variant(const graphene::chain::event_object& event_obj, fc::variant& v, uint32_t max_depth);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::event_object& event_obj, uint32_t max_depth);
|
||||
|
||||
void pack_impl(std::ostream& stream) const;
|
||||
void unpack_impl(std::istream& stream);
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ namespace graphene { namespace chain {
|
|||
} }
|
||||
|
||||
namespace fc {
|
||||
void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v);
|
||||
void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj);
|
||||
void to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||
void from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth = 1);
|
||||
} //end namespace fc
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
|
@ -92,8 +92,8 @@ namespace graphene { namespace chain {
|
|||
template<typename Stream>
|
||||
friend Stream& operator>>( Stream& s, game_object& game_obj );
|
||||
|
||||
friend void ::fc::to_variant(const graphene::chain::game_object& game_obj, fc::variant& v);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::game_object& game_obj);
|
||||
friend void ::fc::to_variant(const graphene::chain::game_object& game_obj, fc::variant& v, uint32_t max_depth);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::game_object& game_obj, uint32_t max_depth);
|
||||
|
||||
void pack_impl(std::ostream& stream) const;
|
||||
void unpack_impl(std::istream& stream);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ namespace graphene { namespace chain {
|
|||
} }
|
||||
|
||||
namespace fc {
|
||||
void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v);
|
||||
void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj);
|
||||
void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||
void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth = 1);
|
||||
} //end namespace fc
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
|
@ -84,8 +84,8 @@ namespace graphene { namespace chain {
|
|||
template<typename Stream>
|
||||
friend Stream& operator>>( Stream& s, match_object& match_obj );
|
||||
|
||||
friend void ::fc::to_variant(const graphene::chain::match_object& match_obj, fc::variant& v);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::match_object& match_obj);
|
||||
friend void ::fc::to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth);
|
||||
|
||||
void pack_impl(std::ostream& stream) const;
|
||||
void unpack_impl(std::istream& stream);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ namespace graphene { namespace chain {
|
|||
} }
|
||||
|
||||
namespace fc {
|
||||
void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v);
|
||||
void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj);
|
||||
void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth = 1);
|
||||
void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth = 1);
|
||||
} //end namespace fc
|
||||
|
||||
namespace graphene { namespace chain {
|
||||
|
|
@ -108,8 +108,8 @@ namespace graphene { namespace chain {
|
|||
template<typename Stream>
|
||||
friend Stream& operator>>( Stream& s, tournament_object& tournament_obj );
|
||||
|
||||
friend void ::fc::to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj);
|
||||
friend void ::fc::to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth);
|
||||
friend void ::fc::from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth);
|
||||
|
||||
void pack_impl(std::ostream& stream) const;
|
||||
void unpack_impl(std::istream& stream);
|
||||
|
|
|
|||
|
|
@ -364,41 +364,41 @@ namespace graphene { namespace chain {
|
|||
|
||||
namespace fc {
|
||||
// Manually reflect match_object to variant to properly reflect "state"
|
||||
void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v)
|
||||
void to_variant(const graphene::chain::match_object& match_obj, fc::variant& v, uint32_t max_depth)
|
||||
{ try {
|
||||
fc_elog(fc::logger::get("tournament"), "In match_obj to_variant");
|
||||
elog("In match_obj to_variant");
|
||||
fc::mutable_variant_object o;
|
||||
o("id", match_obj.id)
|
||||
("tournament_id", match_obj.tournament_id)
|
||||
("players", match_obj.players)
|
||||
("games", match_obj.games)
|
||||
("game_winners", match_obj.game_winners)
|
||||
("number_of_wins", match_obj.number_of_wins)
|
||||
("number_of_ties", match_obj.number_of_ties)
|
||||
("match_winners", match_obj.match_winners)
|
||||
("start_time", match_obj.start_time)
|
||||
("end_time", match_obj.end_time)
|
||||
("state", match_obj.get_state());
|
||||
o("id", fc::variant(match_obj.id, max_depth))
|
||||
("tournament_id", fc::variant(match_obj.tournament_id, max_depth))
|
||||
("players", fc::variant(match_obj.players, max_depth))
|
||||
("games", fc::variant(match_obj.games, max_depth))
|
||||
("game_winners", fc::variant(match_obj.game_winners, max_depth))
|
||||
("number_of_wins", fc::variant(match_obj.number_of_wins, max_depth))
|
||||
("number_of_ties", fc::variant(match_obj.number_of_ties, max_depth))
|
||||
("match_winners", fc::variant(match_obj.match_winners, max_depth))
|
||||
("start_time", fc::variant(match_obj.start_time, max_depth))
|
||||
("end_time", fc::variant(match_obj.end_time, max_depth))
|
||||
("state", fc::variant(match_obj.get_state(), max_depth));
|
||||
|
||||
v = o;
|
||||
} FC_RETHROW_EXCEPTIONS(warn, "") }
|
||||
|
||||
// Manually reflect match_object to variant to properly reflect "state"
|
||||
void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj)
|
||||
void from_variant(const fc::variant& v, graphene::chain::match_object& match_obj, uint32_t max_depth)
|
||||
{ try {
|
||||
fc_elog(fc::logger::get("tournament"), "In match_obj from_variant");
|
||||
match_obj.id = v["id"].as<graphene::chain::match_id_type>();
|
||||
match_obj.tournament_id = v["tournament_id"].as<graphene::chain::tournament_id_type>();
|
||||
match_obj.players = v["players"].as<std::vector<graphene::chain::account_id_type> >();
|
||||
match_obj.games = v["games"].as<std::vector<graphene::chain::game_id_type> >();
|
||||
match_obj.game_winners = v["game_winners"].as<std::vector<flat_set<graphene::chain::account_id_type> > >();
|
||||
match_obj.number_of_wins = v["number_of_wins"].as<std::vector<uint32_t> >();
|
||||
match_obj.number_of_ties = v["number_of_ties"].as<uint32_t>();
|
||||
match_obj.match_winners = v["match_winners"].as<flat_set<graphene::chain::account_id_type> >();
|
||||
match_obj.start_time = v["start_time"].as<time_point_sec>();
|
||||
match_obj.end_time = v["end_time"].as<optional<time_point_sec> >();
|
||||
graphene::chain::match_state state = v["state"].as<graphene::chain::match_state>();
|
||||
match_obj.id = v["id"].as<graphene::chain::match_id_type>( max_depth );
|
||||
match_obj.tournament_id = v["tournament_id"].as<graphene::chain::tournament_id_type>( max_depth );
|
||||
match_obj.players = v["players"].as<std::vector<graphene::chain::account_id_type> >( max_depth );
|
||||
match_obj.games = v["games"].as<std::vector<graphene::chain::game_id_type> >( max_depth );
|
||||
match_obj.game_winners = v["game_winners"].as<std::vector<flat_set<graphene::chain::account_id_type> > >( max_depth );
|
||||
match_obj.number_of_wins = v["number_of_wins"].as<std::vector<uint32_t> >( max_depth );
|
||||
match_obj.number_of_ties = v["number_of_ties"].as<uint32_t>( max_depth );
|
||||
match_obj.match_winners = v["match_winners"].as<flat_set<graphene::chain::account_id_type> >( max_depth );
|
||||
match_obj.start_time = v["start_time"].as<time_point_sec>( max_depth );
|
||||
match_obj.end_time = v["end_time"].as<optional<time_point_sec> >( max_depth );
|
||||
graphene::chain::match_state state = v["state"].as<graphene::chain::match_state>( max_depth );
|
||||
const_cast<int*>(match_obj.my->state_machine.current_state())[0] = (int)state;
|
||||
} FC_RETHROW_EXCEPTIONS(warn, "") }
|
||||
} //end namespace fc
|
||||
|
|
|
|||
|
|
@ -722,37 +722,37 @@ namespace graphene { namespace chain {
|
|||
|
||||
namespace fc {
|
||||
// Manually reflect tournament_object to variant to properly reflect "state"
|
||||
void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v)
|
||||
void to_variant(const graphene::chain::tournament_object& tournament_obj, fc::variant& v, uint32_t max_depth)
|
||||
{
|
||||
fc_elog(fc::logger::get("tournament"), "In tournament_obj to_variant");
|
||||
elog("In tournament_obj to_variant");
|
||||
fc::mutable_variant_object o;
|
||||
o("id", tournament_obj.id)
|
||||
("creator", tournament_obj.creator)
|
||||
("options", tournament_obj.options)
|
||||
("start_time", tournament_obj.start_time)
|
||||
("end_time", tournament_obj.end_time)
|
||||
("prize_pool", tournament_obj.prize_pool)
|
||||
("registered_players", tournament_obj.registered_players)
|
||||
("tournament_details_id", tournament_obj.tournament_details_id)
|
||||
("state", tournament_obj.get_state());
|
||||
o("id", fc::variant(tournament_obj.id, max_depth))
|
||||
("creator", fc::variant(tournament_obj.creator, max_depth))
|
||||
("options", fc::variant(tournament_obj.options, max_depth))
|
||||
("start_time", fc::variant(tournament_obj.start_time, max_depth))
|
||||
("end_time", fc::variant(tournament_obj.end_time, max_depth))
|
||||
("prize_pool", fc::variant(tournament_obj.prize_pool, max_depth))
|
||||
("registered_players", fc::variant(tournament_obj.registered_players, max_depth))
|
||||
("tournament_details_id", fc::variant(tournament_obj.tournament_details_id, max_depth))
|
||||
("state", fc::variant(tournament_obj.get_state(), max_depth));
|
||||
|
||||
v = o;
|
||||
}
|
||||
|
||||
// Manually reflect tournament_object to variant to properly reflect "state"
|
||||
void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj)
|
||||
void from_variant(const fc::variant& v, graphene::chain::tournament_object& tournament_obj, uint32_t max_depth)
|
||||
{
|
||||
fc_elog(fc::logger::get("tournament"), "In tournament_obj from_variant");
|
||||
tournament_obj.id = v["id"].as<graphene::chain::tournament_id_type>();
|
||||
tournament_obj.creator = v["creator"].as<graphene::chain::account_id_type>();
|
||||
tournament_obj.options = v["options"].as<graphene::chain::tournament_options>();
|
||||
tournament_obj.start_time = v["start_time"].as<optional<time_point_sec> >();
|
||||
tournament_obj.end_time = v["end_time"].as<optional<time_point_sec> >();
|
||||
tournament_obj.prize_pool = v["prize_pool"].as<graphene::chain::share_type>();
|
||||
tournament_obj.registered_players = v["registered_players"].as<uint32_t>();
|
||||
tournament_obj.tournament_details_id = v["tournament_details_id"].as<graphene::chain::tournament_details_id_type>();
|
||||
graphene::chain::tournament_state state = v["state"].as<graphene::chain::tournament_state>();
|
||||
tournament_obj.id = v["id"].as<graphene::chain::tournament_id_type>( max_depth );
|
||||
tournament_obj.creator = v["creator"].as<graphene::chain::account_id_type>( max_depth );
|
||||
tournament_obj.options = v["options"].as<graphene::chain::tournament_options>( max_depth );
|
||||
tournament_obj.start_time = v["start_time"].as<optional<time_point_sec> >( max_depth );
|
||||
tournament_obj.end_time = v["end_time"].as<optional<time_point_sec> >( max_depth );
|
||||
tournament_obj.prize_pool = v["prize_pool"].as<graphene::chain::share_type>( max_depth );
|
||||
tournament_obj.registered_players = v["registered_players"].as<uint32_t>( max_depth );
|
||||
tournament_obj.tournament_details_id = v["tournament_details_id"].as<graphene::chain::tournament_details_id_type>( max_depth );
|
||||
graphene::chain::tournament_state state = v["state"].as<graphene::chain::tournament_state>( max_depth );
|
||||
const_cast<int*>(tournament_obj.my->state_machine.current_state())[0] = (int)state;
|
||||
}
|
||||
} //end namespace fc
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ void witness_plugin::plugin_initialize(const boost::program_options::variables_m
|
|||
_options = &options;
|
||||
LOAD_VALUE_SET(options, "witness-id", _witnesses, chain::witness_id_type)
|
||||
if (options.count("witness-ids"))
|
||||
boost::insert(_witnesses, fc::json::from_string(options.at("witness-ids").as<string>()).as<vector<chain::witness_id_type>>());
|
||||
boost::insert(_witnesses, fc::json::from_string(options.at("witness-ids").as<string>()).as<vector<chain::witness_id_type>>( 5 ));
|
||||
|
||||
if( options.count("private-key") )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -378,8 +378,8 @@ private:
|
|||
{
|
||||
try
|
||||
{
|
||||
object_id_type id = changed_object_variant["id"].as<tournament_id_type>();
|
||||
tournament_object current_tournament_obj = changed_object_variant.as<tournament_object>();
|
||||
object_id_type id = changed_object_variant["id"].as<tournament_id_type>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
tournament_object current_tournament_obj = changed_object_variant.as<tournament_object>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
auto tournament_cache_iter = tournament_cache.find(id);
|
||||
if (tournament_cache_iter != tournament_cache.end())
|
||||
{
|
||||
|
|
@ -411,8 +411,8 @@ private:
|
|||
}
|
||||
try
|
||||
{
|
||||
object_id_type id = changed_object_variant["id"].as<match_id_type>();
|
||||
match_object current_match_obj = changed_object_variant.as<match_object>();
|
||||
object_id_type id = changed_object_variant["id"].as<match_id_type>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
match_object current_match_obj = changed_object_variant.as<match_object>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
auto match_cache_iter = match_cache.find(id);
|
||||
if (match_cache_iter != match_cache.end())
|
||||
{
|
||||
|
|
@ -436,8 +436,8 @@ private:
|
|||
}
|
||||
try
|
||||
{
|
||||
object_id_type id = changed_object_variant["id"].as<game_id_type>();
|
||||
game_object current_game_obj = changed_object_variant.as<game_object>();
|
||||
object_id_type id = changed_object_variant["id"].as<game_id_type>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
game_object current_game_obj = changed_object_variant.as<game_object>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
auto game_cache_iter = game_cache.find(id);
|
||||
if (game_cache_iter != game_cache.end())
|
||||
{
|
||||
|
|
@ -460,10 +460,10 @@ private:
|
|||
}
|
||||
try
|
||||
{
|
||||
object_id_type id = changed_object_variant["id"].as<account_id_type>();
|
||||
object_id_type id = changed_object_variant["id"].as<account_id_type>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
if (_wallet.my_accounts.find(id) != _wallet.my_accounts.end())
|
||||
{
|
||||
account_object account = changed_object_variant.as<account_object>();
|
||||
account_object account = changed_object_variant.as<account_object>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
_wallet.update_account(account);
|
||||
}
|
||||
continue;
|
||||
|
|
@ -2516,29 +2516,6 @@ public:
|
|||
return ss.str();
|
||||
};
|
||||
|
||||
m["get_account_history_by_operations"] = [this](variant result, const fc::variants& a) {
|
||||
auto r = result.as<account_history_operation_detail>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
std::stringstream ss;
|
||||
ss << "total_count : ";
|
||||
ss << r.total_count;
|
||||
ss << " \n";
|
||||
ss << "result_count : ";
|
||||
ss << r.result_count;
|
||||
ss << " \n";
|
||||
for (operation_detail_ex& d : r.details) {
|
||||
operation_history_object& i = d.op;
|
||||
auto b = _remote_db->get_block_header(i.block_num);
|
||||
FC_ASSERT(b);
|
||||
ss << b->timestamp.to_iso_string() << " ";
|
||||
i.op.visit(operation_printer(ss, *this, i.result));
|
||||
ss << " transaction_id : ";
|
||||
ss << d.transaction_id.str();
|
||||
ss << " \n";
|
||||
}
|
||||
|
||||
return ss.str();
|
||||
};
|
||||
|
||||
m["list_account_balances"] = [this](variant result, const fc::variants& a)
|
||||
{
|
||||
auto r = result.as<vector<asset>>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
|
|
@ -2558,7 +2535,7 @@ public:
|
|||
{
|
||||
std::stringstream ss;
|
||||
|
||||
auto balances = result.as<vector<account_balance_object>>();
|
||||
auto balances = result.as<vector<account_balance_object>>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
for (const account_balance_object& balance: balances)
|
||||
{
|
||||
const account_object& account = get_account(balance.owner);
|
||||
|
|
@ -2634,14 +2611,14 @@ public:
|
|||
};
|
||||
m["get_upcoming_tournaments"] = m["get_tournaments"] = m["get_tournaments_by_state"] = [this](variant result, const fc::variants& a)
|
||||
{
|
||||
const vector<tournament_object> tournaments = result.as<vector<tournament_object> >();
|
||||
const vector<tournament_object> tournaments = result.as<vector<tournament_object> >( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
std::stringstream ss;
|
||||
ss << "ID GAME BUY IN PLAYERS\n";
|
||||
ss << "====================================================================================\n";
|
||||
for( const tournament_object& tournament_obj : tournaments )
|
||||
{
|
||||
asset_object buy_in_asset = get_asset(tournament_obj.options.buy_in.asset_id);
|
||||
ss << fc::variant(tournament_obj.id).as<std::string>() << " "
|
||||
ss << fc::variant(tournament_obj.id, 1).as<std::string>( 1 ) << " "
|
||||
<< buy_in_asset.amount_to_pretty_string(tournament_obj.options.buy_in.amount) << " "
|
||||
<< tournament_obj.options.number_of_players << " players\n";
|
||||
switch (tournament_obj.get_state())
|
||||
|
|
@ -2684,8 +2661,8 @@ public:
|
|||
{
|
||||
std::stringstream ss;
|
||||
|
||||
tournament_object tournament = result.as<tournament_object>();
|
||||
tournament_details_object tournament_details = _remote_db->get_objects({result["tournament_details_id"].as<object_id_type>()})[0].as<tournament_details_object>();
|
||||
tournament_object tournament = result.as<tournament_object>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
tournament_details_object tournament_details = _remote_db->get_objects({result["tournament_details_id"].as<object_id_type>( 5 )})[0].as<tournament_details_object>( 5 );
|
||||
tournament_state state = tournament.get_state();
|
||||
if (state == tournament_state::accepting_registrations)
|
||||
{
|
||||
|
|
@ -2994,7 +2971,7 @@ public:
|
|||
const chain_parameters& current_params = get_global_properties().parameters;
|
||||
asset_update_dividend_operation changed_op;
|
||||
fc::reflector<asset_update_dividend_operation>::visit(
|
||||
fc::from_variant_visitor<asset_update_dividend_operation>( changed_values, changed_op )
|
||||
fc::from_variant_visitor<asset_update_dividend_operation>( changed_values, changed_op, GRAPHENE_MAX_NESTED_OBJECTS )
|
||||
);
|
||||
|
||||
optional<asset_object> asset_to_update = find_asset(changed_op.asset_to_update);
|
||||
|
|
@ -5817,7 +5794,7 @@ vector<tournament_object> wallet_api::get_tournaments_by_state(tournament_id_typ
|
|||
|
||||
tournament_object wallet_api::get_tournament(tournament_id_type id)
|
||||
{
|
||||
return my->_remote_db->get_objects({id})[0].as<tournament_object>();
|
||||
return my->_remote_db->get_objects({id})[0].as<tournament_object>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
}
|
||||
|
||||
signed_transaction wallet_api::rps_throw(game_id_type game_id,
|
||||
|
|
|
|||
|
|
@ -261,8 +261,8 @@ fc::optional<fc::logging_config> load_logging_config_from_ini_file(const fc::pat
|
|||
console_appender_config.level_colors.emplace_back(
|
||||
fc::console_appender::level_color(fc::log_level::error,
|
||||
fc::console_appender::color::cyan));
|
||||
console_appender_config.stream = fc::variant(stream_name).as<fc::console_appender::stream::type>();
|
||||
logging_config.appenders.push_back(fc::appender_config(console_appender_name, "console", fc::variant(console_appender_config)));
|
||||
console_appender_config.stream = fc::variant(stream_name, 1).as<fc::console_appender::stream::type>(1);
|
||||
logging_config.appenders.push_back(fc::appender_config(console_appender_name, "console", fc::variant(console_appender_config, 20)));
|
||||
found_logging_config = true;
|
||||
}
|
||||
else if (boost::starts_with(section_name, file_appender_section_prefix))
|
||||
|
|
@ -281,7 +281,7 @@ fc::optional<fc::logging_config> load_logging_config_from_ini_file(const fc::pat
|
|||
file_appender_config.rotate = true;
|
||||
file_appender_config.rotation_interval = fc::hours(1);
|
||||
file_appender_config.rotation_limit = fc::days(1);
|
||||
logging_config.appenders.push_back(fc::appender_config(file_appender_name, "file", fc::variant(file_appender_config)));
|
||||
logging_config.appenders.push_back(fc::appender_config(file_appender_name, "file", fc::variant(file_appender_config, 20)));
|
||||
found_logging_config = true;
|
||||
}
|
||||
else if (boost::starts_with(section_name, logger_section_prefix))
|
||||
|
|
@ -290,7 +290,7 @@ fc::optional<fc::logging_config> load_logging_config_from_ini_file(const fc::pat
|
|||
std::string level_string = section_tree.get<std::string>("level");
|
||||
std::string appenders_string = section_tree.get<std::string>("appenders");
|
||||
fc::logger_config logger_config(logger_name);
|
||||
logger_config.level = fc::variant(level_string).as<fc::log_level>();
|
||||
logger_config.level = fc::variant(level_string, 1).as<fc::log_level>(1);
|
||||
boost::split(logger_config.appenders, appenders_string,
|
||||
boost::is_any_of(" ,"),
|
||||
boost::token_compress_on);
|
||||
|
|
|
|||
|
|
@ -962,7 +962,7 @@ BOOST_AUTO_TEST_CASE(persistent_objects_test)
|
|||
fc::variants objects_from_bookie = bookie_api.get_objects({automatically_canceled_bet_id});
|
||||
idump((objects_from_bookie));
|
||||
BOOST_REQUIRE_EQUAL(objects_from_bookie.size(), 1u);
|
||||
BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as<bet_id_type>() == automatically_canceled_bet_id, "Bookie Plugin didn't return a deleted bet it");
|
||||
BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as<bet_id_type>(1) == automatically_canceled_bet_id, "Bookie Plugin didn't return a deleted bet it");
|
||||
|
||||
// lay 47 at 1.94 odds (50:47) -- this bet should go on the order books normally
|
||||
bet_id_type first_bet_on_books = place_bet(alice_id, capitals_win_market.id, bet_type::lay, asset(47, asset_id_type()), 194 * GRAPHENE_BETTING_ODDS_PRECISION / 100);
|
||||
|
|
@ -971,7 +971,7 @@ BOOST_AUTO_TEST_CASE(persistent_objects_test)
|
|||
objects_from_bookie = bookie_api.get_objects({first_bet_on_books});
|
||||
idump((objects_from_bookie));
|
||||
BOOST_REQUIRE_EQUAL(objects_from_bookie.size(), 1u);
|
||||
BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as<bet_id_type>() == first_bet_on_books, "Bookie Plugin didn't return a bet that is currently on the books");
|
||||
BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as<bet_id_type>(1) == first_bet_on_books, "Bookie Plugin didn't return a bet that is currently on the books");
|
||||
|
||||
// place a bet that exactly matches 'first_bet_on_books', should result in empty books (thus, no bet_objects from the blockchain)
|
||||
bet_id_type matching_bet = place_bet(bob_id, capitals_win_market.id, bet_type::back, asset(50, asset_id_type()), 194 * GRAPHENE_BETTING_ODDS_PRECISION / 100);
|
||||
|
|
@ -982,8 +982,8 @@ BOOST_AUTO_TEST_CASE(persistent_objects_test)
|
|||
objects_from_bookie = bookie_api.get_objects({first_bet_on_books, matching_bet});
|
||||
idump((objects_from_bookie));
|
||||
BOOST_REQUIRE_EQUAL(objects_from_bookie.size(), 2u);
|
||||
BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as<bet_id_type>() == first_bet_on_books, "Bookie Plugin didn't return a bet that has been filled");
|
||||
BOOST_CHECK_MESSAGE(objects_from_bookie[1]["id"].as<bet_id_type>() == matching_bet, "Bookie Plugin didn't return a bet that has been filled");
|
||||
BOOST_CHECK_MESSAGE(objects_from_bookie[0]["id"].as<bet_id_type>(1) == first_bet_on_books, "Bookie Plugin didn't return a bet that has been filled");
|
||||
BOOST_CHECK_MESSAGE(objects_from_bookie[1]["id"].as<bet_id_type>(1) == matching_bet, "Bookie Plugin didn't return a bet that has been filled");
|
||||
|
||||
update_betting_market_group(moneyline_betting_markets.id, _status = betting_market_group_status::closed);
|
||||
|
||||
|
|
@ -1249,7 +1249,7 @@ BOOST_AUTO_TEST_CASE( chained_market_create_test )
|
|||
|
||||
for (const witness_id_type& witness_id : active_witnesses)
|
||||
{
|
||||
BOOST_TEST_MESSAGE("Approving sport+competitors creation from witness " << fc::variant(witness_id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("Approving sport+competitors creation from witness " << fc::variant(witness_id, 1).as<std::string>(1));
|
||||
const witness_object& witness = witness_id(db);
|
||||
const account_object& witness_account = witness.witness_account(db);
|
||||
|
||||
|
|
@ -2077,7 +2077,7 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_1)
|
|||
// removed.
|
||||
fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id});
|
||||
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "settled");
|
||||
} FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
||||
|
|
@ -2138,12 +2138,12 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_1_with_delay)
|
|||
blackhawks_win_market_id});
|
||||
|
||||
idump((objects_from_bookie));
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[1]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[2]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[2]["resolution"].as<std::string>(), "win");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[3]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[3]["resolution"].as<std::string>(), "not_win");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[1]["status"].as<std::string>(1), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[2]["status"].as<std::string>(1), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[2]["resolution"].as<std::string>(1), "win");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[3]["status"].as<std::string>(1), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[3]["resolution"].as<std::string>(1), "not_win");
|
||||
} FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
||||
|
|
@ -2230,7 +2230,7 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_2)
|
|||
// removed.
|
||||
fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id});
|
||||
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "settled");
|
||||
} FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
||||
|
|
@ -2318,7 +2318,7 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_2_never_in_play)
|
|||
// removed.
|
||||
fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id});
|
||||
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "settled");
|
||||
} FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
||||
|
|
@ -2393,7 +2393,7 @@ BOOST_AUTO_TEST_CASE(event_driven_standard_progression_3)
|
|||
// and group will cease to exist. The event should transition to "canceled", then be removed
|
||||
fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id});
|
||||
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(), "canceled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "canceled");
|
||||
|
||||
} FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
|
@ -2488,7 +2488,7 @@ BOOST_AUTO_TEST_CASE(event_driven_progression_errors_1)
|
|||
generate_blocks(1);
|
||||
|
||||
fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id});
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(), "canceled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "canceled");
|
||||
|
||||
// we can't go back to upcoming, in_progress, frozen, or finished once we're canceled.
|
||||
// (this won't work because the event has been deleted)
|
||||
|
|
@ -2540,7 +2540,7 @@ BOOST_AUTO_TEST_CASE(event_driven_progression_errors_2)
|
|||
// as soon as a block is generated, the betting market group will settle, and the market
|
||||
// and group will cease to exist. The event should transition to "settled", then removed
|
||||
fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id});
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "settled");
|
||||
|
||||
// we can't go back to upcoming, in_progress, frozen, or finished once we're canceled.
|
||||
// (this won't work because the event has been deleted)
|
||||
|
|
@ -2612,7 +2612,7 @@ BOOST_AUTO_TEST_CASE(betting_market_group_driven_standard_progression)
|
|||
// as soon as a block is generated, the betting market group will settle, and the market
|
||||
// and group will cease to exist. The event should transition to "settled"
|
||||
fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id});
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "settled");
|
||||
} FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
||||
|
|
@ -2723,7 +2723,7 @@ BOOST_AUTO_TEST_CASE(multi_betting_market_group_driven_standard_progression)
|
|||
// as soon as a block is generated, the two betting market groups will settle, and the market
|
||||
// and group will cease to exist. The event should transition to "settled"
|
||||
fc::variants objects_from_bookie = bookie_api.get_objects({capitals_vs_blackhawks_id});
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(), "settled");
|
||||
BOOST_CHECK_EQUAL(objects_from_bookie[0]["status"].as<std::string>(1), "settled");
|
||||
} FC_LOG_AND_RETHROW()
|
||||
}
|
||||
|
||||
|
|
@ -2834,13 +2834,13 @@ BOOST_AUTO_TEST_CASE( wimbledon_2017_gentelmen_singles_sf_test )
|
|||
transfer(account_id_type(), alice_id, asset(10000000));
|
||||
transfer(account_id_type(), bob_id, asset(10000000));
|
||||
|
||||
BOOST_TEST_MESSAGE("moneyline_berdych_vs_federer " << fc::variant(moneyline_berdych_vs_federer.id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("moneyline_cilic_vs_querrey " << fc::variant(moneyline_cilic_vs_querrey.id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("moneyline_berdych_vs_federer " << fc::variant(moneyline_berdych_vs_federer.id, 1).as<std::string>(1));
|
||||
BOOST_TEST_MESSAGE("moneyline_cilic_vs_querrey " << fc::variant(moneyline_cilic_vs_querrey.id, 1).as<std::string>(1));
|
||||
|
||||
BOOST_TEST_MESSAGE("berdych_wins_market " << fc::variant(berdych_wins_market.id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("federer_wins_market " << fc::variant(federer_wins_market.id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("cilic_wins_market " << fc::variant(cilic_wins_market.id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("querrey_wins_market " << fc::variant(querrey_wins_market.id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("berdych_wins_market " << fc::variant(berdych_wins_market.id, 1).as<std::string>(1));
|
||||
BOOST_TEST_MESSAGE("federer_wins_market " << fc::variant(federer_wins_market.id, 1).as<std::string>(1));
|
||||
BOOST_TEST_MESSAGE("cilic_wins_market " << fc::variant(cilic_wins_market.id, 1).as<std::string>(1));
|
||||
BOOST_TEST_MESSAGE("querrey_wins_market " << fc::variant(querrey_wins_market.id, 1).as<std::string>(1));
|
||||
|
||||
place_bet(alice_id, berdych_wins_market.id, bet_type::back, asset(1000000, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
|
||||
place_bet(bob_id, berdych_wins_market.id, bet_type::lay, asset(1000000, asset_id_type()), 2 * GRAPHENE_BETTING_ODDS_PRECISION);
|
||||
|
|
@ -2895,10 +2895,10 @@ BOOST_AUTO_TEST_CASE( wimbledon_2017_gentelmen_singles_final_test )
|
|||
transfer(account_id_type(), alice_id, asset(10000000));
|
||||
transfer(account_id_type(), bob_id, asset(10000000));
|
||||
|
||||
BOOST_TEST_MESSAGE("moneyline_cilic_vs_federer " << fc::variant(moneyline_cilic_vs_federer.id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("moneyline_cilic_vs_federer " << fc::variant(moneyline_cilic_vs_federer.id, 1).as<std::string>(1));
|
||||
|
||||
BOOST_TEST_MESSAGE("federer_wins_final_market " << fc::variant(federer_wins_final_market.id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("cilic_wins_final_market " << fc::variant(cilic_wins_final_market.id).as<std::string>());
|
||||
BOOST_TEST_MESSAGE("federer_wins_final_market " << fc::variant(federer_wins_final_market.id, 1).as<std::string>(1));
|
||||
BOOST_TEST_MESSAGE("cilic_wins_final_market " << fc::variant(cilic_wins_final_market.id, 1).as<std::string>(1));
|
||||
|
||||
betting_market_group_id_type moneyline_cilic_vs_federer_id = moneyline_cilic_vs_federer.id;
|
||||
update_betting_market_group(moneyline_cilic_vs_federer_id, _status = betting_market_group_status::in_play);
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ BOOST_AUTO_TEST_CASE(subscribe_to_pending_transactions) {
|
|||
|
||||
signed_transaction transaction_in_notification;
|
||||
network_node_api.subscribe_to_pending_transactions([&]( const variant& signed_transaction_object ){
|
||||
transaction_in_notification = signed_transaction_object.as<signed_transaction>();
|
||||
transaction_in_notification = signed_transaction_object.as<signed_transaction>( GRAPHENE_MAX_NESTED_OBJECTS );
|
||||
});
|
||||
|
||||
auto sam_transaction = push_transaction_for_account_creation("sam");
|
||||
|
|
|
|||
Loading…
Reference in a new issue