bool isstartledger(ledger::ref ledger) override { return ((ledger->getledgerseq() > 2) && (ledger->gettotalcoins() < vrp_increase_max || ledger->gettotalcoinsvbc() < vbc_increase_max) && (ledger->getclosetime().time_of_day().hours() == 1) && ((ledger->getclosetimenc() - ledger->getdividendtimenc()) > 3600) ); }
void dostartvalidation(ledger::ref lastclosedledger, stobject& basevalidation) override { // lcl must be validation ledger assert (isstartledger(lastclosedledger)); std::uint32_t dividendledger = lastclosedledger->getledgerseq(); std::uint64_t dividendcoins = vrp_increase_rate * lastclosedledger->gettotalcoinsvbc() / vrp_increase_rate_parts; if (dividendcoins + lastclosedledger->gettotalcoins() > vrp_increase_max) { dividendcoins = 0; } std::uint64_t dividendcoinsvbc = 0; if (lastclosedledger->gettotalcoinsvbc() < vbc_increase_max) { if (lastclosedledger->getclosetimenc() < vbc_dividend_period_1) { dividendcoinsvbc = vbc_increase_rate_1 * lastclosedledger->gettotalcoinsvbc() / vbc_increase_rate_1_parts; } else if (lastclosedledger->getclosetimenc() < vbc_dividend_period_2) { dividendcoinsvbc = vbc_increase_rate_2 * lastclosedledger->gettotalcoinsvbc() / vbc_increase_rate_2_parts; } else if (lastclosedledger->getclosetimenc() < vbc_dividend_period_3) { dividendcoinsvbc = vbc_increase_rate_3 * lastclosedledger->gettotalcoinsvbc() / vbc_increase_rate_3_parts; } else { dividendcoinsvbc = vbc_increase_rate_4 * lastclosedledger->gettotalcoinsvbc() / vbc_increase_rate_4_parts; } if (dividendcoinsvbc + lastclosedledger->gettotalcoinsvbc() > vbc_increase_max) dividendcoinsvbc = 0; } if (dividendcoins==0 && dividendcoinsvbc==0) { if (m_journal.warning) m_journal.warning << "not voting for a dividend start because both vrp and vbc will exceed max."; return; } basevalidation.setfieldu32 (sfdividendledger, dividendledger); basevalidation.setfieldu64 (sfdividendcoins, dividendcoins); basevalidation.setfieldu64 (sfdividendcoinsvbc, dividendcoinsvbc); if (m_journal.info) m_journal.info << "voting for a dividend start based " << dividendledger << " with vrp "<< dividendcoins << " vbc " << dividendcoinsvbc << " in " << lastclosedledger->gethash(); }
bool isapplyledger(ledger::ref ledger) override { return (ledger->isdividendstarted() && ((ledger->getclosetimenc() - ledger->getdividendtimenc()) >= 120) ); }