Skip to content

Commit

Permalink
system contract cleanup: remove special handling for eosio delegating…
Browse files Browse the repository at this point in the history
…/buying EOSIO#3430
  • Loading branch information
moskvanaft committed May 25, 2018
1 parent e306198 commit fe2296e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
20 changes: 8 additions & 12 deletions contracts/eosio.system/delegate_bandwidth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,10 @@ namespace eosiosystem {
auto quant_after_fee = quant;
quant_after_fee.amount -= fee.amount;

if( payer != N(eosio) ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {payer,N(active)},
{ payer, N(eosio.ram), quant_after_fee, std::string("buy ram") } );
}
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {payer,N(active)},
{ payer, N(eosio.ram), quant_after_fee, std::string("buy ram") } );

if( payer != N(eosio) && fee.amount > 0 ) {
if( fee.amount > 0 ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {payer,N(active)},
{ payer, N(eosio.ramfee), fee, std::string("ram fee") } );
}
Expand Down Expand Up @@ -182,14 +180,12 @@ namespace eosiosystem {
});
set_resource_limits( res_itr->owner, res_itr->ram_bytes, res_itr->net_weight.amount, res_itr->cpu_weight.amount );

if( N(eosio) != account ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio.ram),N(active)},
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {N(eosio.ram),N(active)},
{ N(eosio.ram), account, asset(tokens_out), std::string("sell ram") } );
auto fee = tokens_out.amount / 200;
if( fee > 0 ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {account,N(active)},
{ account, N(eosio.ramfee), asset(fee), std::string("sell ram fee") } );
}
auto fee = tokens_out.amount / 200;
if( fee > 0 ) {
INLINE_ACTION_SENDER(eosio::token, transfer)( N(eosio.token), {account,N(active)},
{ account, N(eosio.ramfee), asset(fee), std::string("sell ram fee") } );
}
}

Expand Down
2 changes: 0 additions & 2 deletions unittests/eosio.system_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ BOOST_AUTO_TEST_SUITE(eosio_system_tests)

BOOST_FIXTURE_TEST_CASE( buysell, eosio_system_tester ) try {

BOOST_REQUIRE_EQUAL( core_from_string("1000000000.0000"), get_balance( "eosio" ) + get_balance( "eosio.ramfee" ) + get_balance( "eosio.stake" ) );
BOOST_REQUIRE_EQUAL( core_from_string("0.0000"), get_balance( "alice1111111" ) );

transfer( "eosio", "alice1111111", core_from_string("1000.0000"), "eosio" );
Expand Down Expand Up @@ -119,7 +118,6 @@ BOOST_FIXTURE_TEST_CASE( buysell, eosio_system_tester ) try {

BOOST_FIXTURE_TEST_CASE( stake_unstake, eosio_system_tester ) try {

BOOST_REQUIRE_EQUAL( core_from_string("1000000000.0000"), get_balance( "eosio" ) + get_balance( "eosio.ramfee" ) + get_balance( "eosio.stake" ) );
BOOST_REQUIRE_EQUAL( core_from_string("0.0000"), get_balance( "alice1111111" ) );
transfer( "eosio", "alice1111111", core_from_string("1000.0000"), "eosio" );

Expand Down
3 changes: 0 additions & 3 deletions unittests/eosio_system_tester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ class eosio_system_tester : public TESTER {
create_account_with_resources( N(alice1111111), config::system_account_name, core_from_string("1.0000"), false );
create_account_with_resources( N(bob111111111), config::system_account_name, core_from_string("0.4500"), false );
create_account_with_resources( N(carol1111111), config::system_account_name, core_from_string("1.0000"), false );


BOOST_REQUIRE_EQUAL( core_from_string("1000000000.0000"), get_balance("eosio") + get_balance("eosio.ramfee") + get_balance("eosio.stake"));
}


Expand Down

0 comments on commit fe2296e

Please sign in to comment.