Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change punishment transfer memo #120

Merged
merged 7 commits into from
Dec 27, 2019
19 changes: 10 additions & 9 deletions contracts/contracts/rem.system/src/producer_pay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ namespace eosiosystem {
}
const auto punishment = prod.pending_pervote_reward - producer_per_vote_pay;

if ( producer_per_vote_pay > 0 ) {
token::transfer_action transfer_act{ token_account, { {vpay_account, active_permission}, {producer, active_permission} } };
transfer_act.send( vpay_account, producer, asset(producer_per_vote_pay, core_symbol()), "producer vote pay" );
}
if ( punishment > 0 ) {
string punishment_memo = "punishment transfer: missed " + std::to_string(expected_produced_blocks - prod.unpaid_blocks) + " blocks out of " + std::to_string(expected_produced_blocks);
token::transfer_action transfer_act{ token_account, { {vpay_account, active_permission} } };
transfer_act.send( vpay_account, saving_account, asset(punishment, core_symbol()), punishment_memo );
}

_gstate.pervote_bucket -= producer_per_vote_pay;
_gstate.total_unpaid_blocks -= prod.unpaid_blocks;

Expand All @@ -312,15 +322,6 @@ namespace eosiosystem {
p.expected_produced_blocks = 0;
p.pending_pervote_reward = 0;
});

if ( producer_per_vote_pay > 0 ) {
token::transfer_action transfer_act{ token_account, { {vpay_account, active_permission}, {producer, active_permission} } };
transfer_act.send( vpay_account, producer, asset(producer_per_vote_pay, core_symbol()), "producer vote pay" );
}
if ( punishment > 0 ) {
token::transfer_action transfer_act{ token_account, { {vpay_account, active_permission} } };
transfer_act.send( vpay_account, saving_account, asset(punishment, core_symbol()), "punishment transfer" );
}
}

void system_contract::claimrewards( const name& owner ) {
Expand Down