asset_ops.hpp: Change bitasset_options member name to bitasset_opts to fix gcc compile
This commit is contained in:
parent
6899202892
commit
a41384d4b1
7 changed files with 31 additions and 31 deletions
|
|
@ -45,9 +45,9 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o
|
||||||
|
|
||||||
core_fee_paid -= core_fee_paid.value/2;
|
core_fee_paid -= core_fee_paid.value/2;
|
||||||
|
|
||||||
if( op.bitasset_options )
|
if( op.bitasset_opts )
|
||||||
{
|
{
|
||||||
const asset_object& backing = op.bitasset_options->short_backing_asset(d);
|
const asset_object& backing = op.bitasset_opts->short_backing_asset(d);
|
||||||
if( backing.is_market_issued() )
|
if( backing.is_market_issued() )
|
||||||
{
|
{
|
||||||
const asset_bitasset_data_object& backing_bitasset_data = backing.bitasset_data(d);
|
const asset_bitasset_data_object& backing_bitasset_data = backing.bitasset_data(d);
|
||||||
|
|
@ -59,13 +59,13 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o
|
||||||
} else
|
} else
|
||||||
FC_ASSERT( op.issuer != GRAPHENE_COMMITTEE_ACCOUNT || backing.get_id() == asset_id_type(),
|
FC_ASSERT( op.issuer != GRAPHENE_COMMITTEE_ACCOUNT || backing.get_id() == asset_id_type(),
|
||||||
"May not create a blockchain-controlled market asset which is not backed by CORE.");
|
"May not create a blockchain-controlled market asset which is not backed by CORE.");
|
||||||
FC_ASSERT( op.bitasset_options->feed_lifetime_sec > chain_parameters.block_interval &&
|
FC_ASSERT( op.bitasset_opts->feed_lifetime_sec > chain_parameters.block_interval &&
|
||||||
op.bitasset_options->force_settlement_delay_sec > chain_parameters.block_interval );
|
op.bitasset_opts->force_settlement_delay_sec > chain_parameters.block_interval );
|
||||||
}
|
}
|
||||||
if( op.is_prediction_market )
|
if( op.is_prediction_market )
|
||||||
{
|
{
|
||||||
FC_ASSERT( op.bitasset_options );
|
FC_ASSERT( op.bitasset_opts );
|
||||||
FC_ASSERT( op.precision == op.bitasset_options->short_backing_asset(d).precision );
|
FC_ASSERT( op.precision == op.bitasset_opts->short_backing_asset(d).precision );
|
||||||
}
|
}
|
||||||
|
|
||||||
return void_result();
|
return void_result();
|
||||||
|
|
@ -80,9 +80,9 @@ object_id_type asset_create_evaluator::do_apply( const asset_create_operation& o
|
||||||
});
|
});
|
||||||
|
|
||||||
asset_bitasset_data_id_type bit_asset_id;
|
asset_bitasset_data_id_type bit_asset_id;
|
||||||
if( op.bitasset_options.valid() )
|
if( op.bitasset_opts.valid() )
|
||||||
bit_asset_id = db().create<asset_bitasset_data_object>( [&]( asset_bitasset_data_object& a ) {
|
bit_asset_id = db().create<asset_bitasset_data_object>( [&]( asset_bitasset_data_object& a ) {
|
||||||
a.options = *op.bitasset_options;
|
a.options = *op.bitasset_opts;
|
||||||
a.is_prediction_market = op.is_prediction_market;
|
a.is_prediction_market = op.is_prediction_market;
|
||||||
}).id;
|
}).id;
|
||||||
|
|
||||||
|
|
@ -99,7 +99,7 @@ object_id_type asset_create_evaluator::do_apply( const asset_create_operation& o
|
||||||
else
|
else
|
||||||
a.options.core_exchange_rate.base.asset_id = next_asset_id;
|
a.options.core_exchange_rate.base.asset_id = next_asset_id;
|
||||||
a.dynamic_asset_data_id = dyn_asset.id;
|
a.dynamic_asset_data_id = dyn_asset.id;
|
||||||
if( op.bitasset_options.valid() )
|
if( op.bitasset_opts.valid() )
|
||||||
a.bitasset_data_id = bit_asset_id;
|
a.bitasset_data_id = bit_asset_id;
|
||||||
});
|
});
|
||||||
assert( new_asset.id == next_asset_id );
|
assert( new_asset.id == next_asset_id );
|
||||||
|
|
|
||||||
|
|
@ -362,14 +362,14 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
||||||
{
|
{
|
||||||
asset_dynamic_data_id_type dynamic_data_id;
|
asset_dynamic_data_id_type dynamic_data_id;
|
||||||
optional<asset_bitasset_data_id_type> bitasset_data_id;
|
optional<asset_bitasset_data_id_type> bitasset_data_id;
|
||||||
if( asset.bitasset_options.valid() )
|
if( asset.bitasset_opts.valid() )
|
||||||
{
|
{
|
||||||
share_type total_allocated;
|
share_type total_allocated;
|
||||||
asset_id_type new_asset_id = get_index_type<asset_index>().get_next_id();
|
asset_id_type new_asset_id = get_index_type<asset_index>().get_next_id();
|
||||||
asset_id_type collateral_asset_id = get_asset_id(asset.bitasset_options->backing_asset_symbol);
|
asset_id_type collateral_asset_id = get_asset_id(asset.bitasset_opts->backing_asset_symbol);
|
||||||
|
|
||||||
int collateral_holder_number = 0;
|
int collateral_holder_number = 0;
|
||||||
for( const auto& collateral_rec : asset.bitasset_options->collateral_records )
|
for( const auto& collateral_rec : asset.bitasset_opts->collateral_records )
|
||||||
{
|
{
|
||||||
account_create_operation cop;
|
account_create_operation cop;
|
||||||
cop.name = asset.symbol + "-collateral-holder-" + std::to_string(collateral_holder_number);
|
cop.name = asset.symbol + "-collateral-holder-" + std::to_string(collateral_holder_number);
|
||||||
|
|
@ -385,19 +385,19 @@ void database::init_genesis(const genesis_state_type& genesis_state)
|
||||||
c.debt = collateral_rec.debt;
|
c.debt = collateral_rec.debt;
|
||||||
c.call_price = price::call_price(chain::asset(c.debt, new_asset_id),
|
c.call_price = price::call_price(chain::asset(c.debt, new_asset_id),
|
||||||
chain::asset(c.collateral, collateral_asset_id),
|
chain::asset(c.collateral, collateral_asset_id),
|
||||||
asset.bitasset_options->maintenance_collateral_ratio);
|
asset.bitasset_opts->maintenance_collateral_ratio);
|
||||||
});
|
});
|
||||||
|
|
||||||
total_allocated += collateral_rec.debt;
|
total_allocated += collateral_rec.debt;
|
||||||
}
|
}
|
||||||
|
|
||||||
bitasset_data_id = create<asset_bitasset_data_object>([&](asset_bitasset_data_object& b) {
|
bitasset_data_id = create<asset_bitasset_data_object>([&](asset_bitasset_data_object& b) {
|
||||||
b.options.feed_lifetime_sec = asset.bitasset_options->feed_lifetime_sec;
|
b.options.feed_lifetime_sec = asset.bitasset_opts->feed_lifetime_sec;
|
||||||
b.options.minimum_feeds = asset.bitasset_options->minimum_feeds;
|
b.options.minimum_feeds = asset.bitasset_opts->minimum_feeds;
|
||||||
b.options.force_settlement_delay_sec = asset.bitasset_options->force_settlement_delay_sec;
|
b.options.force_settlement_delay_sec = asset.bitasset_opts->force_settlement_delay_sec;
|
||||||
b.options.force_settlement_offset_percent = asset.bitasset_options->force_settlement_offset_percent;
|
b.options.force_settlement_offset_percent = asset.bitasset_opts->force_settlement_offset_percent;
|
||||||
b.options.maximum_force_settlement_volume = asset.bitasset_options->maximum_force_settlement_volume;
|
b.options.maximum_force_settlement_volume = asset.bitasset_opts->maximum_force_settlement_volume;
|
||||||
b.options.short_backing_asset = get_asset_id(asset.bitasset_options->backing_asset_symbol);
|
b.options.short_backing_asset = get_asset_id(asset.bitasset_opts->backing_asset_symbol);
|
||||||
}).id;
|
}).id;
|
||||||
|
|
||||||
dynamic_data_id = create<asset_dynamic_data_object>([&](asset_dynamic_data_object& d) {
|
dynamic_data_id = create<asset_dynamic_data_object>([&](asset_dynamic_data_object& d) {
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ struct genesis_state_type {
|
||||||
uint16_t maintenance_collateral_ratio;
|
uint16_t maintenance_collateral_ratio;
|
||||||
vector<initial_collateral_position> collateral_records;
|
vector<initial_collateral_position> collateral_records;
|
||||||
};
|
};
|
||||||
optional<initial_bitasset_options> bitasset_options;
|
optional<initial_bitasset_options> bitasset_opts;
|
||||||
|
|
||||||
share_type initial_accumulated_fees;
|
share_type initial_accumulated_fees;
|
||||||
};
|
};
|
||||||
|
|
@ -102,7 +102,7 @@ FC_REFLECT(graphene::chain::genesis_state_type::initial_account_type, (name)(own
|
||||||
|
|
||||||
FC_REFLECT(graphene::chain::genesis_state_type::initial_asset_type,
|
FC_REFLECT(graphene::chain::genesis_state_type::initial_asset_type,
|
||||||
(symbol)(description)(precision)(issuer_name)(max_supply)(market_fee_percent)
|
(symbol)(description)(precision)(issuer_name)(max_supply)(market_fee_percent)
|
||||||
(issuer_permissions)(flags)(bitasset_options)(initial_accumulated_fees))
|
(issuer_permissions)(flags)(bitasset_opts)(initial_accumulated_fees))
|
||||||
|
|
||||||
FC_REFLECT(graphene::chain::genesis_state_type::initial_asset_type::initial_bitasset_options,
|
FC_REFLECT(graphene::chain::genesis_state_type::initial_asset_type::initial_bitasset_options,
|
||||||
(feed_lifetime_sec)(minimum_feeds)(force_settlement_delay_sec)(force_settlement_offset_percent)
|
(feed_lifetime_sec)(minimum_feeds)(force_settlement_delay_sec)(force_settlement_offset_percent)
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ namespace graphene { namespace chain {
|
||||||
asset_options common_options;
|
asset_options common_options;
|
||||||
/// Options only available for BitAssets. MUST be non-null if and only if the @ref market_issued flag is set in
|
/// Options only available for BitAssets. MUST be non-null if and only if the @ref market_issued flag is set in
|
||||||
/// common_options.flags
|
/// common_options.flags
|
||||||
optional<bitasset_options> bitasset_options;
|
optional<bitasset_options> bitasset_opts;
|
||||||
/// For BitAssets, set this to true if the asset implements a @ref prediction_market; false otherwise
|
/// For BitAssets, set this to true if the asset implements a @ref prediction_market; false otherwise
|
||||||
bool is_prediction_market = false;
|
bool is_prediction_market = false;
|
||||||
|
|
||||||
|
|
@ -412,7 +412,7 @@ FC_REFLECT( graphene::chain::asset_create_operation,
|
||||||
(symbol)
|
(symbol)
|
||||||
(precision)
|
(precision)
|
||||||
(common_options)
|
(common_options)
|
||||||
(bitasset_options)
|
(bitasset_opts)
|
||||||
(is_prediction_market)
|
(is_prediction_market)
|
||||||
)
|
)
|
||||||
FC_REFLECT( graphene::chain::asset_update_operation,
|
FC_REFLECT( graphene::chain::asset_update_operation,
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,13 @@ void asset_create_operation::validate()const
|
||||||
FC_ASSERT( is_valid_symbol(symbol) );
|
FC_ASSERT( is_valid_symbol(symbol) );
|
||||||
common_options.validate();
|
common_options.validate();
|
||||||
if( common_options.issuer_permissions & (disable_force_settle|global_settle) )
|
if( common_options.issuer_permissions & (disable_force_settle|global_settle) )
|
||||||
FC_ASSERT( bitasset_options.valid() );
|
FC_ASSERT( bitasset_opts.valid() );
|
||||||
if( is_prediction_market )
|
if( is_prediction_market )
|
||||||
{
|
{
|
||||||
FC_ASSERT( bitasset_options.valid(), "Cannot have a User-Issued Asset implement a prediction market." );
|
FC_ASSERT( bitasset_opts.valid(), "Cannot have a User-Issued Asset implement a prediction market." );
|
||||||
FC_ASSERT( common_options.issuer_permissions & global_settle );
|
FC_ASSERT( common_options.issuer_permissions & global_settle );
|
||||||
}
|
}
|
||||||
if( bitasset_options ) bitasset_options->validate();
|
if( bitasset_opts ) bitasset_opts->validate();
|
||||||
|
|
||||||
asset dummy = asset(1) * common_options.core_exchange_rate;
|
asset dummy = asset(1) * common_options.core_exchange_rate;
|
||||||
FC_ASSERT(dummy.asset_id == asset_id_type(1));
|
FC_ASSERT(dummy.asset_id == asset_id_type(1));
|
||||||
|
|
@ -147,7 +147,7 @@ void asset_update_feed_producers_operation::validate() const
|
||||||
FC_ASSERT( fee.amount >= 0 );
|
FC_ASSERT( fee.amount >= 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void asset_global_settle_operation::validate()const
|
void asset_global_settle_operation::validate()const
|
||||||
{
|
{
|
||||||
FC_ASSERT( fee.amount >= 0 );
|
FC_ASSERT( fee.amount >= 0 );
|
||||||
FC_ASSERT( asset_to_settle == settle_price.base.asset_id );
|
FC_ASSERT( asset_to_settle == settle_price.base.asset_id );
|
||||||
|
|
|
||||||
|
|
@ -901,7 +901,7 @@ public:
|
||||||
create_op.symbol = symbol;
|
create_op.symbol = symbol;
|
||||||
create_op.precision = precision;
|
create_op.precision = precision;
|
||||||
create_op.common_options = common;
|
create_op.common_options = common;
|
||||||
create_op.bitasset_options = bitasset_opts;
|
create_op.bitasset_opts = bitasset_opts;
|
||||||
|
|
||||||
signed_transaction tx;
|
signed_transaction tx;
|
||||||
tx.operations.push_back( create_op );
|
tx.operations.push_back( create_op );
|
||||||
|
|
@ -1751,7 +1751,7 @@ void operation_printer::operator()(const account_update_operation& op) const
|
||||||
void operation_printer::operator()(const asset_create_operation& op) const
|
void operation_printer::operator()(const asset_create_operation& op) const
|
||||||
{
|
{
|
||||||
out << "Create ";
|
out << "Create ";
|
||||||
if( op.bitasset_options.valid() )
|
if( op.bitasset_opts.valid() )
|
||||||
out << "BitAsset ";
|
out << "BitAsset ";
|
||||||
else
|
else
|
||||||
out << "User-Issue Asset ";
|
out << "User-Issue Asset ";
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,7 @@ const asset_object& database_fixture::create_bitasset(
|
||||||
creator.common_options.issuer_permissions = flags;
|
creator.common_options.issuer_permissions = flags;
|
||||||
creator.common_options.flags = flags & ~global_settle;
|
creator.common_options.flags = flags & ~global_settle;
|
||||||
creator.common_options.core_exchange_rate = price({asset(1,1),asset(1)});
|
creator.common_options.core_exchange_rate = price({asset(1,1),asset(1)});
|
||||||
creator.bitasset_options = bitasset_options();
|
creator.bitasset_opts = bitasset_options();
|
||||||
trx.operations.push_back(std::move(creator));
|
trx.operations.push_back(std::move(creator));
|
||||||
trx.validate();
|
trx.validate();
|
||||||
processed_transaction ptx = db.push_transaction(trx, ~0);
|
processed_transaction ptx = db.push_transaction(trx, ~0);
|
||||||
|
|
@ -442,7 +442,7 @@ const asset_object& database_fixture::create_prediction_market(
|
||||||
creator.common_options.issuer_permissions = flags | global_settle;
|
creator.common_options.issuer_permissions = flags | global_settle;
|
||||||
creator.common_options.flags = flags & ~global_settle;
|
creator.common_options.flags = flags & ~global_settle;
|
||||||
creator.common_options.core_exchange_rate = price({asset(1,1),asset(1)});
|
creator.common_options.core_exchange_rate = price({asset(1,1),asset(1)});
|
||||||
creator.bitasset_options = bitasset_options();
|
creator.bitasset_opts = bitasset_options();
|
||||||
creator.is_prediction_market = true;
|
creator.is_prediction_market = true;
|
||||||
trx.operations.push_back(std::move(creator));
|
trx.operations.push_back(std::move(creator));
|
||||||
trx.validate();
|
trx.validate();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue