本文整理汇总了C++中operation::visit方法的典型用法代码示例。如果您正苦于以下问题:C++ operation::visit方法的具体用法?C++ operation::visit怎么用?C++ operation::visit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类operation
的用法示例。
在下文中一共展示了operation::visit方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operation_get_required_authorities
void operation_get_required_authorities( const operation& op,
flat_set<account_id_type>& active,
flat_set<account_id_type>& owner,
vector<authority>& other )
{
op.visit( operation_get_required_auth( active, owner, other ) );
}
示例2: calculate_fee
asset fee_schedule::calculate_fee( const operation& op, const price& core_exchange_rate )const
{
//idump( (op)(core_exchange_rate) );
fee_parameters params; params.set_which(op.which());
auto itr = parameters.find(params);
if( itr != parameters.end() ) params = *itr;
auto base_value = op.visit( calc_fee_visitor( params ) );
auto scaled = fc::uint128(base_value) * scale;
scaled /= GRAPHENE_100_PERCENT;
FC_ASSERT( scaled <= GRAPHENE_MAX_SHARE_SUPPLY );
auto result = asset( scaled.to_uint64(), 0 ) * core_exchange_rate;
FC_ASSERT( result.amount <= GRAPHENE_MAX_SHARE_SUPPLY );
return result;
}
示例3: calculate_fee
asset fee_schedule::calculate_fee( const operation& op, const price& core_exchange_rate )const
{
auto base_value = op.visit( calc_fee_visitor( *this, op ) );
auto scaled = fc::uint128(base_value) * scale;
scaled /= GRAPHENE_100_PERCENT;
FC_ASSERT( scaled <= GRAPHENE_MAX_SHARE_SUPPLY );
//idump( (base_value)(scaled)(core_exchange_rate) );
auto result = asset( scaled.to_uint64(), asset_id_type(0) ) * core_exchange_rate;
//FC_ASSERT( result * core_exchange_rate >= asset( scaled.to_uint64()) );
while( result * core_exchange_rate < asset( scaled.to_uint64()) )
result.amount++;
FC_ASSERT( result.amount <= GRAPHENE_MAX_SHARE_SUPPLY );
return result;
}
示例4: set_fee
asset fee_schedule::set_fee( operation& op, const price& core_exchange_rate )const
{
auto f = calculate_fee( op, core_exchange_rate );
auto f_max = f;
for( int i=0; i<MAX_FEE_STABILIZATION_ITERATION; i++ )
{
op.visit( set_fee_visitor( f_max ) );
auto f2 = calculate_fee( op, core_exchange_rate );
if( f == f2 )
break;
f_max = std::max( f_max, f2 );
f = f2;
if( i == 0 )
{
// no need for warnings on later iterations
wlog( "set_fee requires multiple iterations to stabilize with core_exchange_rate ${p} on operation ${op}",
("p", core_exchange_rate) ("op", op) );
}
}
return f_max;
}
示例5: set_fee
asset fee_schedule::set_fee( operation& op, const price& core_exchange_rate )const
{
auto f = calculate_fee( op, core_exchange_rate );
op.visit( set_fee_visitor( f ) );
return f;
}
示例6: operation_validate
void operation_validate( const operation& op )
{
op.visit( operation_validator() );
}