Skip to content

Commit

Permalink
Cleanup implementation #2705
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandeberg committed Jul 30, 2019
1 parent 98eaeb1 commit 5ccfb9c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 113 deletions.
78 changes: 1 addition & 77 deletions libraries/plugins/rc/include/steem/plugins/rc/rc_operations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,71 +34,11 @@ struct delegate_to_pool_operation : steem::protocol::base_operation
void get_required_active_authorities( flat_set<account_name_type>& a )const { a.insert( from_account ); }
};

/**
* Delegate SP or a vesting SMT from a pool to a user.
*
* What is actually delegated are DRC (delegated RC). The from_pool account is allowed to "freely print"
* DRC from its own pool. This is equal to the RC that pool user is allowed to consume.
* Pools may be over-subscribed (i.e. total DRC output is greater than RC input).
*
* Executing this operation effectively _replaces_ the effect of the previous
* `delegate_drc_from_pool_operation` with the same `(to_account, to_slot)` pair.
*
* When deciding whether the affected manabar sections are full or empty,
* the decision is always made in favor of `to_account`:
*
* - When increasing delegation, new DRC is always created to fill the new manabar section.
* - When removing delegation, DRC may be destroyed, but only to the extent necessary for the account not to exceed its newly reduced maximum.
*/
/*
struct delegate_drc_from_pool_operation : steem::protocol::base_operation
{
account_name_type from_pool;
account_name_type to_account;
int8_t to_slot = 0;
asset_symbol_type asset_symbol;
int64_t drc_max_mana = 0;
extensions_type extensions;
void validate()const;
void get_required_active_authorities( flat_set<account_name_type>& a )const { a.insert( from_pool ); }
};
*/

/**
* The purpose of set_slot_delegator_operation is to set the delegator allowed to delegate to a
* `(to_account, to_slot)` pair.
*
* To delegate to a slot, from_pool must be considered the delegator of the slot. Normally the delegator is
* the account creator. The set_slot_delegator_operation allows a new delegator to be appointed by either
* the existing delegator, the account itself, or (in the case of slot 1, STEEM_RC_RECOVERY_SLOT_NUM)
* the slot may also be set by the account's recovery partner.
*/
/*
struct set_slot_delegator_operation : steem::protocol::base_operation
{
account_name_type from_pool;
account_name_type to_account;
int8_t to_slot = 0;
account_name_type signer;
extensions_type extensions;
void validate()const;
void get_required_active_authorities( flat_set<account_name_type>& a )const { a.insert( signer ); }
};
*/

typedef fc::static_variant<
delegate_to_pool_operation
//delegate_drc_from_pool_operation,
//set_slot_delegator_operation
> rc_plugin_operation;

STEEM_DEFINE_PLUGIN_EVALUATOR( rc_plugin, rc_plugin_operation, delegate_to_pool );
//STEEM_DEFINE_PLUGIN_EVALUATOR( rc_plugin, rc_plugin_operation, delegate_drc_from_pool );
//STEEM_DEFINE_PLUGIN_EVALUATOR( rc_plugin, rc_plugin_operation, set_slot_delegator );

} } } // steem::plugins::rc

Expand All @@ -108,22 +48,6 @@ FC_REFLECT( steem::plugins::rc::delegate_to_pool_operation,
(amount)
(extensions)
)
/*
FC_REFLECT( steem::plugins::rc::delegate_drc_from_pool_operation,
(from_pool)
(to_account)
(to_slot)
(asset_symbol)
(drc_max_mana)
(extensions)
)
FC_REFLECT( steem::plugins::rc::set_slot_delegator_operation,
(from_pool)
(to_account)
(to_slot)
(signer)
(extensions)
)
*/

STEEM_DECLARE_OPERATION_TYPE( steem::plugins::rc::rc_plugin_operation )
FC_REFLECT_TYPENAME( steem::plugins::rc::rc_plugin_operation )
34 changes: 0 additions & 34 deletions libraries/plugins/rc/rc_operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,6 @@ void delegate_to_pool_operation::validate()const
FC_ASSERT( amount.symbol == VESTS_SYMBOL, "Currently can only delegate VESTS (SMT's not supported #2698)" );
FC_ASSERT( amount.amount.value >= 0, "Delegation to pool cannot be negative" );
}
/*
void delegate_drc_from_pool_operation::validate()const
{
validate_account_name( from_pool );
validate_account_name( to_account );
FC_ASSERT( to_slot >= 0 );
FC_ASSERT( to_slot < STEEM_RC_MAX_OUTDEL_SLOTS );
FC_ASSERT( asset_symbol.is_vesting(), "Must use vesting symbol" );
FC_ASSERT( asset_symbol == VESTS_SYMBOL, "Currently can only delegate VESTS (SMT's not supported #2698)" );
FC_ASSERT( drc_max_mana >= 0 );
}
void set_slot_delegator_operation::validate()const
{
validate_account_name( from_pool );
validate_account_name( to_account );
validate_account_name( signer );
FC_ASSERT( to_slot >= 0 );
FC_ASSERT( to_slot < STEEM_RC_MAX_OUTDEL_SLOTS );
}
*/

void delegate_to_pool_evaluator::do_apply( const delegate_to_pool_operation& op )
{
Expand Down Expand Up @@ -167,17 +144,6 @@ void delegate_to_pool_evaluator::do_apply( const delegate_to_pool_operation& op
}
} );
}
/*
void delegate_drc_from_pool_evaluator::do_apply( const delegate_drc_from_pool_operation& op )
{
FC_ASSERT( false, "Operation not yet supported" );
}
void set_slot_delegator_evaluator::do_apply( const set_slot_delegator_operation& op )
{
FC_ASSERT( false, "Operation not yet supported" );
}
*/

} } } // steem::plugins::rc

Expand Down
2 changes: 0 additions & 2 deletions libraries/plugins/rc/rc_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1383,8 +1383,6 @@ void rc_plugin::plugin_initialize( const boost::program_options::variables_map&

// Add each operation evaluator to the registry
my->_custom_operation_interpreter->register_evaluator< delegate_to_pool_evaluator >( this );
//my->_custom_operation_interpreter->register_evaluator< delegate_drc_from_pool_evaluator >( this );
//my->_custom_operation_interpreter->register_evaluator< set_slot_delegator_evaluator >( this );

// Add the registry to the database so the database can delegate custom ops to the plugin
my->_db.register_custom_operation_interpreter( my->_custom_operation_interpreter );
Expand Down

0 comments on commit 5ccfb9c

Please sign in to comment.