Skip to content

Commit

Permalink
correction remarks2 #353
Browse files Browse the repository at this point in the history
  • Loading branch information
kudzinp committed Jan 29, 2019
1 parent 63dd8cc commit 14477b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions golos.publication/golos.publication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,10 @@ void publication::set_vote(name voter, name author, string permlink, int16_t wei
std::vector<structures::delegate_voter> delegators;
auto token_code = pool->state.funds.symbol.code();
auto list_delegate_voter = golos::vesting::get_list_delegate(config::vesting_name, voter, token_code);
auto effective_vesting = golos::vesting::get_account_effective_vesting(config::vesting_name, voter, token_code);
for (auto record : list_delegate_voter)
delegators.push_back( {record.sender, record.quantity, record.interest_rate,
record.payout_strategy, weight} );
record.payout_strategy, effective_vesting} );

vote_table.emplace(voter, [&]( auto &item ) {
item.id = vote_table.available_primary_key();
Expand Down Expand Up @@ -795,7 +796,12 @@ int64_t publication::pay_delegators(uint64_t message_id, int64_t claim, name vot
int64_t dlg_payout_sum = 0;
for (auto delegate_obj : delegate_list) {
if (delegate_obj.payout_strategy == config::to_delegated_vesting) {
auto dlg_payout = claim * delegate_obj.interest_rate / config::_100percent;

auto interest_rate = static_cast<uint64_t>(static_cast<uint128_t>(delegate_obj.quantity.amount) *
delegate_obj.interest_rate / delegate_obj.effective_vesting.amount);

auto dlg_payout = claim * interest_rate / config::_100percent;

tables::account_table acc_table(_self, voter.value);
auto balance = acc_table.find(tokensymbol.code().raw());
acc_table.modify(balance, delegate_obj.delegator, [&](auto& item) {
Expand Down
2 changes: 1 addition & 1 deletion golos.publication/objects.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct delegate_voter {
asset quantity;
uint64_t interest_rate;
uint8_t payout_strategy;
int16_t weight;
asset effective_vesting;
};

struct voteinfo {
Expand Down

0 comments on commit 14477b7

Please sign in to comment.